Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse CDT C++ error

I have just installed Eclipse CDT on my machine for developping C++ applications.

I have created a new C++ project. I have copied a cpp file.

When I click the build button, the project compile without errors.

However, I have a problem. The problem is that Eclipse tell me that there is many errors. For example Eclipse show that "using namespace std" is an error or that "#include " is an error.

I don't know what is the problem with Eclipse because my file compile properly when i click the "build" button.

Is there some settings that I did not set properly?

Thanks!

like image 862
Phil Avatar asked Nov 04 '11 21:11

Phil


People also ask

What is CDT in C?

The C/C++ Development Toolkit (CDT) is a set of Eclipse plug-ins that provide C and C++ extensions to the Eclipse workbench. For more information about Eclipse, see Workbench User Guide > Concepts > Workbench. The CDT provides a C/C++ IDE that simplifies many of the same tools that you can use from the command line.

What is C Eclipse?

Eclipse is an open-source Integrated Development Environment (IDE) supported by IBM. The mother site is @ www.eclipse.org. Eclipse is popular for Java project development. It also supports C/C++, PHP, Python, Perl, and other web project developments via extensible plug-ins.

How do I set up C C++ on Eclipse in Windows?

Test the C/C++ installation as follows: In Eclipse, go to the "File" menu, then "New", then "C++ Project" if it's there. If not, choose "Project", then find "C/C++" in the list of wizards, click the "+" sign to expand it, and choose "C++ Project". A dialog box will ask whether to open the C/C++ perspective.


1 Answers

You need to add the paths to the std libraries to your project in eclipse. It seems that somehow eclipse did not find your std library. You need to add the path to your gcc include under:

properties->C/C++ General->Paths and Symbols->Includes->GNU C and GNU C++

The paths GCC/G++ uses can be found by the commands in this answer to "Where does gcc look for C and C++ header files?".

like image 156
tune2fs Avatar answered Sep 29 '22 06:09

tune2fs