安装、使用eclipse+CDT编译C++程序

我想安装、使用eclipse+CDT的初衷
在看live555的源码,需要方便管理源码的工具:

使用eclipse编译和管理live555源码

http://blog.csdn.net/nkmnkm/article/details/7403027

 

Mac OS 下使用Eclipse + CDT 搭建C/C+ 开发环境

https://segmentfault.com/a/1190000004322054

JDK+Eclipse+CDT+MinGW安装完全版
https://blog.csdn.net/aldenphy/article/details/5643596

 

我的平台:win32

操作系统:win7

eclipse:indigo

 

编译C++的helloworld程序
#include <iostream>
using namespace std;
int main(void)
{
cout<<"Hello Eclipse world!"<<endl;
return 0;
}

symbol cout could not be resolved cannot run program g++
http://blog.csdn.net/yefengmeander/article/details/8159454

提取最后一段结论:

分析一下失败原因:

1.先把mingw的bin路径加到windows的环境变量中,然后在cmd下,输入gcc -v,显示ggc版本,是可以找到gcc的

2.不能把mingw安装到D盘的Program Files下了,因为路径中,包含空格,而gcc是linux下开发的,对空格默认是分隔符,所以此路径非法,所以找不到gcc

3.eclipse cdt安装 下载的与更新安装有一个比较大的区别,下载时plugins下面有一个jar:org.eclipse.cdt.core.win32_5.0.0.200902130801.jar
拷贝到eclipse 中的要解压成文件夹的型式,并删除原来的jar:org.eclipse.cdt.core.win32_5.0.0.200902130801.jar

在32位windows下不是org.eclipse.cdt.core.win32_5.2.0.201202111925.jar这个文件,而是org.eclipse.cdt.core.win32.x86_5.2.0.201202111925.jar这个文件。

 

eclipse写C++控制台程序,不见输出
http://bbs.csdn.net/topics/360207855

16楼正解。

 

cannot open output file .exe: Permission denied
http://stackoverflow.com/questions/6875403/cannot-open-output-file-permission-denied

 

编译C++的STL程序
#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
cout<<"Hello Eclipse world!"<<endl;

vector<int> v;
v.push_back(42);
v.push_back(1984);
cout<<v.at(0)<<endl;
cout<<v.at(1)<<endl;

return 0;
}

error , Symbol 'vector' could not be resolved
http://www.eclipse.org/forums/index.php/t/216821/

3rd floor is correct:

That is true that code analysis in CDT Indigo is not perfect. What you can do is to filter out offending ones in Preferences. You can disable or customize the scope to exclude certain file patterns.

 

结语
最后终于一步步得到了正确的输出。

无论是做开发还是做研究,各种不懂,网上各种找信息、问同行。走弯路难以避免,耐心细致,才能达到预期。

posted on 2019-01-06 14:32  冰山上的博客  阅读(840)  评论(0编辑  收藏  举报