Linux Eclipse CDT 一些错误的解决办法

来源:互联网 发布:算法导论mobi 编辑:程序博客网 时间:2024/05/18 00:45

该C++工程可以通过编译并正确运行,可是在Text Editor上面显示一些下划线和bug标志,非常有碍观瞻,而且估计会影响智能提示。

Unresolved inclusion 错误的解决办法


启动eclipse后,经过 Window-->Preferences-->C/C++-->Build-->Environment增加Environment variables:


Name: C_INCLUDE_PATH


Value: /usr/include


Name: CPLUS_INCLUDE_PATH

Value: /usr/include/c++/4.6

对于诸如下面vector,bitset等等c/c++符号不能解析的问题,

symbol bitset could not be resolved

解决办法类似:

Name: C_INCLUDE_PATH


Value: /usr/include:/usr/include/linux:/usr/include/i386-linux-gnu

Name: CPLUS_INCLUDE_PATH

Value: /usr/include/c++/4.6:/usr/include/c++/4.6/i686-linux-gnu

重启之后,右键点击该工程,index > Rebuild 就可以了。


如果有在PATH中找不到g++的错误,那么添加下面的环境变量就可以了:

Name: PATH

Value: /usr/bin

这样还会消除编辑器上标示的其他一些奇怪的错误,例如bitset<5>: invalid template argument。


相关知识:

The C/C++ indexer uses the parser to create a database of your source and header files that provides the basis for C/C++ search, navigation features and parts of content assist.

0 0
原创粉丝点击