Make Eclipse treat .h file as C++?

荒凉一梦 提交于 2019-12-29 01:38:09

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/226402/make-eclipse-treat-h-file-as-c

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