c++ 11完全支持Eclipse。

时间:2022-08-26 18:35:48

I am trying to find a way to get full C++11 support on Eclipse.

我正在尝试找到一种方法,在Eclipse上获得完整的c++ 11支持。

In Eclipse Juno I had a lot of new features with __GXX_EXPERIMENTAL_CXX0X__ but I didn't find support for std::threads, std::mutex, etc.

在Eclipse Juno中,我有很多新的特性,其中有__gxx_实验性的cxx0x__,但是我没有找到std的支持::threads, std::mutex,等等。

How can I have completion for all C++11 functions?

我怎样才能完成所有c++ 11函数?

EDIT : Solution

编辑:解决方案

Go to Project -> Properties -> C/C++ General -> Path and Symbols -> Tab [Symbols]. Add the symbol : __cplusplus with the value 201103L

Go to Project -> Properties -> C/ c++ General ->路径和符号->标签[符号]。添加符号:__cplusplus的值为201103L。

2 个解决方案

#1


18  

Eclipse works with C+11 support (Indexer and such) just fine: both Juno and Kepler. The thing is that you have to let Eclipse know that you are going to compile with C++11 support. This is done by providing additional flag -std=c++11 to CDT GCC Builtin Compiler Settings in C/C++ -> Build -> Settings -> Discovery [tab] so it will read something like:

Eclipse使用的是C+11支持(Indexer等),这很好:Juno和开普勒。问题是,您必须让Eclipse知道,您将使用c++ 11支持进行编译。这是通过提供额外的标记-std=c++11到CDT GCC Builtin编译器设置在c / c++ ->构建->设置->发现[tab],所以它会读到:

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

And that is all you have to do with Kepler/Juno to get C++11 code highlighted correctly.

这就是你要用开普勒/Juno做的所有事情,以得到正确的c++ 11代码。

Note, this is workspace-wide setting. You can do the same on per project basis if you don't want to set it in workspace.

注意,这是工作空间设置。如果您不想将其设置在工作区中,您可以在每个项目基础上执行相同的操作。

#2


-1  

Is there even a compiler which fully supports C++11? If you are on Windows, then I think you should give Microsoft Visual Studio Express Edition 2013 a try. Its C++11 support is not complete but IMO fairly good, and it looks like it will get even better in the near future.

是否有一个编译器完全支持c++ 11?如果你在Windows上,那么我想你应该给微软Visual Studio Express Edition 2013试一试。它的c++ 11支持不是完整的,但是IMO相当好,而且它看起来在不久的将来会变得更好。

#1


18  

Eclipse works with C+11 support (Indexer and such) just fine: both Juno and Kepler. The thing is that you have to let Eclipse know that you are going to compile with C++11 support. This is done by providing additional flag -std=c++11 to CDT GCC Builtin Compiler Settings in C/C++ -> Build -> Settings -> Discovery [tab] so it will read something like:

Eclipse使用的是C+11支持(Indexer等),这很好:Juno和开普勒。问题是,您必须让Eclipse知道,您将使用c++ 11支持进行编译。这是通过提供额外的标记-std=c++11到CDT GCC Builtin编译器设置在c / c++ ->构建->设置->发现[tab],所以它会读到:

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

And that is all you have to do with Kepler/Juno to get C++11 code highlighted correctly.

这就是你要用开普勒/Juno做的所有事情,以得到正确的c++ 11代码。

Note, this is workspace-wide setting. You can do the same on per project basis if you don't want to set it in workspace.

注意,这是工作空间设置。如果您不想将其设置在工作区中,您可以在每个项目基础上执行相同的操作。

#2


-1  

Is there even a compiler which fully supports C++11? If you are on Windows, then I think you should give Microsoft Visual Studio Express Edition 2013 a try. Its C++11 support is not complete but IMO fairly good, and it looks like it will get even better in the near future.

是否有一个编译器完全支持c++ 11?如果你在Windows上,那么我想你应该给微软Visual Studio Express Edition 2013试一试。它的c++ 11支持不是完整的,但是IMO相当好,而且它看起来在不久的将来会变得更好。