1

I have a Makefile-based Eclipse CDT project, and under Project > Properties > C/C++ General > Preprocessor Include Paths, Macros etc. > GNU C++ > CDT GCC Built-in Compiler Settings > __cplusplus the value is 201402L

I have the -std=c++17 flag set in my Makefile, so the actual value of this predefined macro is 201703L not 201402L.

Clearly, the list of predefined macros in GCC Built-In Compiler Settings was generated without the -std=c++17 flag.

Is it possible to set the compiler flags that are used to generate the list of predefined macros in CDT GCC Built-in Compiler Settings and trigger them to be regenerated? If so where/how is this configured?

Andrew Tomazos
  • 66,139
  • 40
  • 186
  • 319
  • 1
    I believe this is what you need: https://stackoverflow.com/questions/17131744/eclipse-cdt-indexer-does-not-know-c11-containers/24628885#24628885 – Galik Sep 25 '18 at 20:51

1 Answers1

3

On the same preference page, if you switch to the Providers tab (rather than Entries), and select the CDT GCC Built-in Compiler Settings provider, there is a Command to get compiler specs there. You can modify that command, by e.g. adding -std=c++17. Pressing Apply on that page will automatically trigger the provider to run again and update the list of predefined macros.

You can also configure this workspace-wide in Window -> Preferences -> C/C++ -> Build -> Settings -> Discovery tab. The Use global provider shared between projects checkbox (just above Command to get compiler specs) governs whether a project uses the workspace-wide settings, or its own.

HighCommander4
  • 50,428
  • 24
  • 122
  • 194