mac eclipse EDT C++以及symbol 'std' could not be resolved问题的解决
2016-12-29 15:03
841 查看
环境配置
测试文件test.cpp#include <iostream> using namespace std; int main() { cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!! return 0; }
1.安装c++编译环境,确保在命令行下输入g++ test.cpp 能正确生成二进制文件
i. 安装xcode, 在appstore可以下到。此时g++可以用,但是iostream,stdio.h等文件统统没有,因为相关命令行工具没有安装完成(坑爹!!)!
ii. 安装完整的g++命令行工具
Xcode->open developer tool-> More developer tools…
此时会跳转到apple网站上,下载最新版本的Command Line Tools(OS X XXXXX) for Xcode, 安装
OS X的名称,在苹果->about this mac上可以查到os的版本号,然后根据版本号去google它叫什么名字,俺们10.9.3叫Mavericks)
安装完成后,/usr/include下将出现各种熟悉的头文件如stdio.h以及一个目录c++
此时命令行执行g++ test.cpp, 所有报错消失,终于可以成功编过了。
2. 安装eclipse,官网下载
3.安装cdt:
在eclipse ->Help->Install New Softerware.
在最上的url中输入cdt的下载url,http://download.eclipse.org/tools/cdt/releases/juno,
出现CDT Main Features和CDT Optional Features,点开,选定自己需要安装的项,安装
重启eclips,在File ->New->下出现C/C++ Project, CDT安装完成。
4.设置CDT
在eclipse下,Project->Properties->C/C++ General->Paths and Symbols
GNU C 设为/usr/include
GNU C++ 设为/usr/include/c++/版本号
5重启eclips,新建一个c++工程,加入以上测试文件,build,run,大功告成!
symbol ‘std’ could not be resolved问题的解决
include中所有文件是程序编译时候去找头文件的所有地方。
添加方式:
右键点击demo4选最下面的properties:
将会出现如下图:
Preferences-> C/C++- > Build >Environment
点击 add,创建两个变量:
Name: C_INCLUDE_PATH
Value: /usr/include
Name: CPLUS_INCLUDE_PATH
Value: /usr/include/c++
(确定你的C++ 文件地址:
在终端,
cd /usr/include
ls
如果看到有c++文件,说明位置是正确的,否则,从\lib\gcc\i686-pc-cygwin\X.X.X\i
4000
nclude中拷贝进去,然后重启eclipse。
最后,右键点击你的project,
Properties -> C/C++ General -> Paths and Symbols -> Includes -> Languages
看CNU C++以及GUN C对应右边的文件里面应该有/usr/include/c++和/usr/include了。
如下图:
说明设置成功。
但这时候如果发现symbol问题还存在,那么,右键点击你的文件,—>clean project—–>build project(这时候你的project中会出现Binaries)
symbol文件这时候也会消失
然后—- >index——>rebuild
然后—->run as
即可
相关文章推荐
- 解决Eclipse中C++代码显示Symbol 'std' could not be resolved的问题
- 解决Eclipse中C++代码显示Symbol 'std' could not be resolved的问题
- linux eclipse 下 Symbol 'std’could not be resolved 问题的解决
- 解决Eclipse中C++代码显示Symbol 'std' could not be resolved的问题
- 【已解决】NDK下Eclipse中交叉编译C项目出错:Symbol ‘NULL’ could not be resolved(JNI)
- Eclipse编写C++出现Symbol 'std' could not be resolved错误提示的解决方案
- eclipse : Type Symbol 'xxx' could not be resolved 解决办法
- 解决Eclipse交叉编译环境下出现Symbol"NULL" could not be resolved
- eclipse CDT cygwin下出现大量Symbol could not be resolved的解决方法
- Eclipse编写C++出现Symbol 'std' could not be resolved错误提示
- eclipse Type xxxx could not be resolved 问题解决
- window平台下 Eclipse Ndk开发中的Method 'NewStringUTF' could not be resolved问题
- eclipse android ndk 提示Type 'JNIEnv' could not be resolved 等信息解决办法
- Eclipse Ndk开发中的Method 'NewStringUTF' could not be resolved问题
- Application "org.eclipse.ui.ide.workbench" could not be found in the registry.问题的解决
- Function 'app_dummy' could not be resolved问题解决
- eclipse出现Symbol could not be resolved解决方案
- window平台下 Eclipse Ndk开发中的Method 'NewStringUTF' could not be resolved问题
- 关于Quartus II 13.0对应开发NIOS II软件程序时报错Symbol 'NULL' could not be resolved问题的解决方法
- Save could not be completed. Eclipse国际化的问题解决