Eclipse does not find std C ++ - libraries

I have a Windows8 machine with mingw installed in c: \ mingw Eclipse successfully compiles programs, but considers the lines to contain errors that are good when compiling. Eclipse does not find the libraries themselves.

When I first create a project in eclipse with the installation of the CDT components, it shows errors in every #include and every line using the object.

Example:

#include <iostream> using namespace std; int main() { cout << "hello\n"; } 

The above code shows errors in include, use and cout <line. I can get rid of the errors by clicking: project-> C ++ properties / General preprocessor Enable Then on the “Providers” tab I can check the “CDT assembly output parser” and fix the errors as described in the first answer below, which I check. But this only works for the project. I have to do it every time. How can I make eclipse just accept standard C ++ EVERY TIME I create a new project without reconfiguring each project?

I was able to stop errors on startup by going to the project settings and adding directories:

c: / bin / MinGW / Library / GCC / enable ...

This leaves line errors using objects.

 #include <iostream> #include <string> #include <regex> using namespace std; int main() { string s = "this is a test."; regex e("est"); smatch m; 

The regex line still shows an error: “regex type cannot be resolved” even if compilation of the code and inclusion of the regex are recognized.

In addition, on a different machine running Windows 8.1 with Mingw installed, eclipse will not debug. Is there any document on how to connect the Eclipse CDT to the library?

+3
source share
2 answers

As long as you obviously successfully compile code with gcc from Eclipse, Eclipse has its own built-in C ++ parser, and you need to tell it separately that you are using C ++ 11.

Add the -std=c++11 parameter to the CDT GCC Builtin Compiler Settings under Project propierties -> C/C++ General -> Preprocessor Include Paths , the compiler specifications should look something like this:

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

UPDATE. . Please read Configuring Path and Macro Enable for the C / C ++ strong> Indexer to understand how the automatic detection of CDT of included paths and preprocessor characters (aka Scanner Discovery) for supported tool chains applies to you.

The bottom line is that the CDT uses the Language Settings Providers to find the included paths and preprocessor characters. And Language Settings Providers can be configured on the project properties page "Preprocessor Include Paths, Macros, etc."

Once you have the correct settings, you can make it a template workspace and simply copy the template workspace for your new projects or, alternatively, have a script that will only configure the appropriate settings. Also see: Configuring options for all Eclipse workspaces .

+4
source

I had the same problem. Eclipse emphasized the regex keyword as an error, but the project was built without errors. I selected the language dialect as " ISO C++1y (-std=c++1y) " in Properties->C/C++ Build->GCC C++ Compiler->Dialect Language Standart

0
source

All Articles