简体   繁体   中英

Make Eclipse treat .h file as C++?

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 from:

Preferences > C/C++ > File types

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++?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM