How to enable C++11/C++0x support in Eclipse CDT?

后端 未结 17 1525
说谎
说谎 2020-11-22 00:13

Eclipse 3.7.1 CDT 1.4.1 GCC 4.6.2

This is an example of a piece of C++11 code:

auto text = std::unique_ptr(new char[len]);
17条回答
  •  悲哀的现实
    2020-11-22 00:30

    For Eclipse CDT Kepler what worked for me to get rid of std::thread unresolved symbol is:

    1. Go to Preferences->C/C++->Build->Settings

    2. Select the Discovery tab

    3. Select CDT GCC Built-in Compiler Settings [Shared]

    4. Add the -std=c++11 to the "Command to get the compiler specs:" field such as:

    ${COMMAND} -E -P -v -dD -std=c++11 ${INPUTS}

    1. Ok and Rebuild Index for the project.

    Adding -std=c++11 to project Properties/C/C++ Build->Settings->Tool Settings->GCC C++ Compiler->Miscellaneous->Other Flags wasn't enough for Kepler, however it was enough for older versions such as Helios.

提交回复
热议问题