使Eclipse将.h文件视为C ++? [英] Make Eclipse treat .h file as C++?

查看:385
本文介绍了使Eclipse将.h文件视为C ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的所有C ++标头都使用.h扩展名。 Eclipse认为这些是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

但它是已锁定。

有趣的是,* .h与C和C ++头文件相关联,但似乎使用C.我如何让Eclipse将.h文件视为C ++?

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

推荐答案

尝试创建一个新项目并指定您的源区域作为位置。但是,一定要选择C ++项目(我通常使用makefile选项)。这是所有你应该做的,以使解析器识别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.

这篇关于使Eclipse将.h文件视为C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆