Andrey
But if you speak Russian, there is a better chat for this
What do you mean 'better'? I think there are many good C++-ers here.
Andrey
Okay. Let's say that I have several projects, all of them are under cmake. They lay in the same directory, I think it doesn't matter though. The point is I want each of them to use a library whose sources I have. This library is under cmake too. What I do is put the library sources on the same hierarchy level with the projects, or say in a 'lib' directory, the place itself doesn't matter. So each project can use it. Here I think I have two ways: 1) build the lib and share the built lib files or 2) share the lib source location letting each project build the lib themselves. I think I cannot use 'add_subdirectory' for the lib in the projects' CMakeLists.txt files, because the lib location can not be a subdirectory to any of the projects. So, here I'm confused, I don't know what to do best. How should I manage the usage of the shared library?
Danya🔥
What do you mean 'better'? I think there are many good C++-ers here.
It's specialized on the build systems exactly and has more active actual professionals
Danya🔥
Okay. Let's say that I have several projects, all of them are under cmake. They lay in the same directory, I think it doesn't matter though. The point is I want each of them to use a library whose sources I have. This library is under cmake too. What I do is put the library sources on the same hierarchy level with the projects, or say in a 'lib' directory, the place itself doesn't matter. So each project can use it. Here I think I have two ways: 1) build the lib and share the built lib files or 2) share the lib source location letting each project build the lib themselves. I think I cannot use 'add_subdirectory' for the lib in the projects' CMakeLists.txt files, because the lib location can not be a subdirectory to any of the projects. So, here I'm confused, I don't know what to do best. How should I manage the usage of the shared library?
To be honest, I don't understand what the hell you're doing 1) I'd do a following structure: — project1 — project2 — project3 — lib1 — lib2 — lib3 2) Then, in the root you add all these subdirectories: first — libs, then — projects 3) in each CMakeLists for libs you set a variable that tells the include directory for the lib, e.g. set(LIB3_INCLUDE_DIR <some-path>) 4) in each project you do smth like this: add_executable(project3 ...) target_include_directories(project3 PRIVATE $LIB2_INCLUDE_DIR) target_link_libraries(project3 PRIVATE <lib2-target-name>)
Andrey
To be honest, I don't understand what the hell you're doing 1) I'd do a following structure: — project1 — project2 — project3 — lib1 — lib2 — lib3 2) Then, in the root you add all these subdirectories: first — libs, then — projects 3) in each CMakeLists for libs you set a variable that tells the include directory for the lib, e.g. set(LIB3_INCLUDE_DIR <some-path>) 4) in each project you do smth like this: add_executable(project3 ...) target_include_directories(project3 PRIVATE $LIB2_INCLUDE_DIR) target_link_libraries(project3 PRIVATE <lib2-target-name>)
I see: if I want each project to be not dependent on an out-of-tree build files, I better put the lib inside each project and call 'add_subdirectory' in CMakeLists file. You suggest to consider all the projects as a whole one with a root CMakeLists file and subprojects. But it's not the case. Maybe I'm doing something worse than hell. I keep thinking about it. Thank you for the answer!
Kiran
I am to programming. What book u recommend to learn c++ to start with?
Kiran
I have 4th edition of balagurusamy c++
Rose
I am to programming. What book u recommend to learn c++ to start with?
Please check out this channel - @Resources for information on learning sources for C and C++ (books and videos) and Frequently Asked Questions.
Riccardo
Hi!, I am not able to configurate the Qt kits. How can do I?
Riccardo
After creating the Qt kit, i can't select the Qt kit, and continue.
Kiran
How is c++ by stroustsp
Siddhanth
C++ was founded by bjarne stroustrop
Siddhanth
My spelling is bad...pls don't mind
harmony5 🇺🇳 ⌤
I guess they were askings for opinions on a book by stroustrop
Ighor
After creating the Qt kit, i can't select the Qt kit, and continue.
it shows a reason ⚠️ on the kits dialogue, what is there? maybe you forgot to set a compiler to the kit?
Pavel
How is c++ by stroustsp
A tour of C++ 3rd edition is pretty good, they cover a lot of modern stuff (but the book assumes you already know some programming)
Tokin
I know this is not the right place, but can anyone recommend a particular course or book on how an OS works?
Rose
I know this is not the right place, but can anyone recommend a particular course or book on how an OS works?
Offtopic discussions should be done in the C/C++ Offtopic group. Please take your discussion/questions there.
Marlo
Any C# Programming Group??
Danya🔥
Marlo
Ighor
how I do set the compiler in the kit?
in the settings of Qt Creator kits
Algorithm
I can help with all types of coding tasks and exams, especially data structures and algorithms in C++ and Python.
Sarmat
Hi everyone! I'm working with gRPC and i cannot start server, i get this error: At least one of the completion queues must be frequently polled I don't have any async services, can anyone help?
Thomas
Are there any actual good guides for pointers which cover everything there is to them?
klimi
Are there any actual good guides for pointers which cover everything there is to them?
everything? then you might want to read the standard itself
Thomas
Кирилл
Stroustrup website? :)
klimi
Where about can I find the standard?
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
klimi
You're a troll lol
uh? I am not :<
voldy
hi
voldy
please help me if anyone knows good hash libraries
J
/notes
Rose
/notes
List of notes in C/C++ Programming: - 0_to_show_item_use"#item" - gitgud - howtoask - markdown - mcve - meta - ot - paste - projects - res You can retrieve these notes by using /get notename, or #notename
Mark
/get projects
Rose
/get projects
Please check the Resources section for links on Open Source Projects in C/C++ some of which are explained from scratch.
Ludovic 'Archivist'
You're a troll lol
Klimi's just giving them exactly what the person asked. Probably not what they wanted
Tokin
Klimi's just giving them exactly what the person asked. Probably not what they wanted
But I don’t know why… shouldn’t every respectable programmer working with the language get in the habit or practice of using the standard as a reference?
Tokin
Compiler is not your friend
Prince
Hello Please I'm a student and I have a test to write on C++ next week so I need someone to help me grab some basis off head
Ludovic 'Archivist'
Compiler is not your friend
Sometimes the compiler is not conformant, or the standard library is not. People found a new bug in glibc's date and time handling just a couple days ago when someone submitted a bug report to musl thinking their handling of non-existent dates was wrong because it was different from glibc. Turns out glibc is the non conformant one
Luca
Good morning, I noticed a small issue with the C++ API std::filesystem::directory_iterator(path). Essentially, if the path contains the character '°', it throws an std::filesystem_error exception. Do you happen to know if it's possible to resolve this with a workaround?
Luca
I need to check if there’s that specific char in my string and prepend \ ?
Luca
Mhh yeah but how many char works like that, I cannot create if statement for every special char
Thomas
Mhh yeah but how many char works like that, I cannot create if statement for every special char
Not sure, just try it if you got the code available may work may not, tbh I have never seen that character before in a directory
Luca
Yeah, you know, sometimes clients could be crazy
Danya🔥
Yep
The constructor of the directory iterator takes only std::filesystem::path. So it is implicitly constructed from the std::string. Try constructing the path object yourself.
Danya🔥
Are you on windows?
Danya🔥
Yes
Is the path string utf 8?
Danya🔥
On windows native type for path is std::wstring and it should be probably utf16
Ludovic 'Archivist'
If it is not look into making sure your file encoding is
Danya🔥
If it is not look into making sure your file encoding is
No, file encoding doesn't matter. It's only the path string one
Ludovic 'Archivist'
On windows native type for path is std::wstring and it should be probably utf16
either utf8, 16 or 32 should work, but the C++ file encoding needs to be correct
Ludovic 'Archivist'
One of my students messed that up 2 weeks ago
Ludovic 'Archivist'
Used windows 1502 by accident
Danya🔥
One of my students messed that up 2 weeks ago
Let me share with you a handy little code snippet that makes everything UTF-8 on Windows
Danya🔥
#if defined(_WIN32) || defined(_WIN64) #pragma execution_character_set("utf-8") #include<windows.h> const auto _dummy_ = []() { SetConsoleCP(65001); SetConsoleOutputCP(65001); return 0; }(); #endif
Luca
Same error
Danya🔥
Same error
Then try to re-save your C++ file with "Save As..." and select UTF-8 encoding manually. Also, remove the stuff with wstring
Luca
It's a directory not file unfortunatly