7

I'm using Eclipse Mars.2 Release (4.5.2) in Windows. C++11 works well, but for C++14, I can build and run a project using C++14 features without any error, but the IDE always highlights errors in the lines using C++14 features, it makes me difficult to detect real errors.

E.g. When using std::make_unique, it always highlight a bug symbol with notification "Symbol 'make_unique' could not be resolved".

How do I enable C++14 Syntax checking in Eclipse?

My current configuration:

Project property -> C/C++ build -> Setting -> Preprocessor -> Defined symbols:

  • __GXX_EXPERIMENTAL_CXX0X__
  • __cplusplus=201403L

Project property -> C/C++ build -> Setting -> Miscellaneous-> other flags:

  • -c -fmessage-length=0 -std=c++14
Ikarus
  • 1,169
  • 4
  • 14
  • 28

2 Answers2

6

You are going at this the wrong way. To change the compiler and indexer, go to Properties -> C/C++ Build -> Settings. Under GCC C++ Compiler select the Dialect menu. In the Language standard drop down, select C++1y. I don't think the support is full yet however.

Derek Lesho
  • 318
  • 1
  • 3
  • 10
  • The support is full. It works for me, but I always hated how much things needs to be done to make it work. Found only rare cases with `static_casting<>` return values of `std::bind`, but fortunately the parser does not mark them as errors - it's the opposite - the parser does not inform you about some errors that compiler would. – Xeverous Jan 29 '17 at 18:47
  • 4
    I'm using Oxygen.3, and under a C++ project's Properties -> C/C++ Build -> Settings there's no "GCC C++ Compiler" anywhere. I have "Binary Parsers" and "Error Parsers". – einpoklum Apr 24 '18 at 20:05
  • This worked for me in Oxygen. https://stackoverflow.com/a/13635080/3817433 – Mochan Dec 03 '18 at 22:57
1

Keeping the Project property -> C/C++ build -> Setting -> Miscellaneous-> other flags:

-c fmessage-length=0 -std= c++0x

should work..

Ram
  • 21
  • 5
  • 1
    There is no "Miscellaneous" under settings. At least not on my C++ projects. – einpoklum Apr 24 '18 at 20:06
  • When using own makefiles (e.g. because of using CMake, etc.) activate "Generate Makefiles automatically" than change the setting and deactivate settings again! Eclipse will remember the settings even if it hides the tab. – Traummaennlein Jun 25 '19 at 08:59