-std=c++17 makes things worse instead of fixing them [message #1814908] |
Sun, 22 September 2019 10:35  |
Eclipse User |
|
|
|
Hi,
I am using a "Makefile project in a directory containing existing code".
I ensure that the build command emits all g++ invocations in the console window, which I believe is necessary for the "CDT GCC Build Output Parser" mechanism to work properly.
It mostly works perfectly, including indexing.
I have gone though a few of the steps at vulkan-tutorial.com/.
When coming to step 5, vulkan-tutorial.com/code/05_window_surface.cpp, the indexing starts to partly fail: "Type 'std::optional<uint32_t>' could not be resolved".
When I get such an issue, I usually go to Project - Properties - Preprocessor Include Paths, Macros etc. - CDT GCC Built-in Compiler Settings and add "-std=c++17" (or whatever is applicable). When I do that now (${COMMAND} ${FLAGS} -std=c++17 -E -P -v -dD "${INPUTS}") and rebuild the index, instead of the problem being solved, the number of unresolved symbols just increases. The additional unresolved symbols have typically nothing to do with modern C++.
What I think is even weirder is that if I apply the same procedure to a minimal project that uses std::optional, that just works! I can also see that the __cplusplus symbol has the expected value in all cases (201703L when it should, 201402L otherwise), whether indexing works or not.
It looks like there is some kind of combination that breaks things. I have tried removing and adding code, and it seems that the combination std::set and std::optional is somehow involved.
How would I go about if I want to understand more about where the indexing goes wrong?
Also, is it possible the see what values ${COMMAND} and ${FLAGS} have?
Please note that in all cases above, the code builds and run without problem.
Thanks in advance.
Alain
|
|
|
|
Re: -std=c++17 makes things worse instead of fixing them [message #1834786 is a reply to message #1814970] |
Tue, 17 November 2020 16:59  |
Eclipse User |
|
|
|
I'm having similar issue, with a makefile project.
I tried setting the __cplusplus symbol to 201703L, but the CDT seems to override it with it's auto discovery stuff.. Only solution I found was to edit the "Command to get compiler specs" and add -std=c++17 , but the issue with this solution is that it creates a .language.settings file that keeps changing all the time, on its own We have this file ignored by git but that means the C++17 setting is lost.
Google this issue, lead to various solution that seems to change for every release of Eclipse and for every type of project (managed, make etc). Obviously none of the solutions I found worked ;-)
Suggestions?
|
|
|
Powered by
FUDForum. Page generated in 0.06574 seconds