Multiple “could not be resolved” problems using Eclipse with minGW

若如初见. 提交于 2019-11-27 08:40:13

Go to Project -> Properties -> C/C++ General -> Preprocessor Include Paths, Macros, etc. -> Providers -> CDT GCC built-in compiler settings, deactivate Use global provider shared between projects and add the command line argument -std=c++11.

The eclipse live code analysis does not share the same settings with the build compiler. You can also change the setting globally (not just for the project) in Window -> Preferences -> C/C++ -> Build -> Settings -> CDT GCC Built-in Compiler Settings.

Edit: You need to #include <string> to use std::to_string.

I'm adding a few details to the answers given by @Nabla and @Enissey.

When adding the command line argument, for example, CDT GCC Built-in Compiler Settings Cygwin in Global preferences,

${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"

do it like so,

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

To rebuild the index, right-click on your project, go under the Index sub-menu, and choose "Rebuild."

In my case, I made the changes globally and rebuilt the index.

Re download the gcc compiler from:

http://www.equation.com/servlet/equation.cmd?fa=fortran

install it in c:\minGW folder use new worksapce / fresh eclipse setting , it work like a charm!

Don't forget to restart before trying , re build and set etc.

as well to set MinGW as a default tool chain windows -> preferences -> New C++.. ->set MinMG as a tool chain preferred.

If you cannot see it on the list , deselect the "show project types...." as well when creating the project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!