views:

651

answers:

2

I am beginning to use Eclipse Ganymede with CDT at work. Unfortunately, all of our C++ headers use a .h extension. Eclipse thinks these are C headers and flags them with lots of syntax errors on things like classes and namespaces. I've tried to change the file type association, but it's "locked".

Interestingly, "*.h" is associated with both C and C++ headers, but it seems to be using C. How can I get Eclipse to treat .h files as C++?

+1  A: 

Try creating a new project and specify your source area as the location. However, be sure you select C++ project (I usually use the makefile option). This is all you should have to do in order to make the parser recognize C++ syntax.

AdamC
Another factor is that all the source files are accessed through RSE. I figured out how to import files to a project via RSE, and then this solution worked. Thanks!
Fred Larson
... except that once I import them into a project, they seem to be local copies and don't sync via RSE anymore. Rats.
Fred Larson
Found the answer. Instead of importing the files, link an RSE folder to the project.
Fred Larson
A: 

Hello,

I have the same problem. I wrote my C++ code in vS 2005 and now I want to continue on Eclipse. However when I open an empty C++ project in Eclipse and put all my cpp and h files in Eclipse, it gives meaningless errors about including header files and even tries to compile commented code and gives errors/warnings! Does anyone have an idea on how to fix this problem? I should note that my code does not have any dependence to any sort of VS 2005 libraries, etc... therefore it should have been straight forward to use Eclipse.

Thanks.