Eclipse+CDT+Mingw作C/C++ IDE 在eclipse安装cdt插件的步骤

来源:互联网 发布:java处理图片曝光率 编辑:程序博客网 时间:2024/05/22 17:44
cdt是在eclipse中编写C++程序的插件,虽然还不是很完美,但是是在windows中编写linux下C++程序(GNU C++)的一个好途径。

按照eclipse的官方网站的要求,要下载如下的东东:
1.eclipse(
http://www.eclipse.org/downloads/index.php),我下的是3.0,也有更高一点的版本,如果想要有中文帮助的,可以下载2.1.2版,我是把两个都下来,在2.1.2中看帮助,在3.0中用。

2.下载cdt 2.0.2(
http://download.eclipse.org/tools/cdt/releases/new/),cdt的版本也很多,要注意下载的和你eclipse匹配的,支持eclipse 3.0的cdt 2.0.2还不是很成熟,所以在CDT主版本下载页面没有直接给出,你可以在我给的网址下载。

3.下载minGW,这个东西是什么你自己到网上查吧,反正必须有。但是网上不好找(官方网站连不上),我好人做到底,在我的服务器上下吧:
http://2peak.bluesaga.com/other/minGW.exe,然后安装。

4.假设你的minGW安装在c:/mingw目录中,在环境变量中设置PATH=c:/mingw/bin;这句一定放在最前面,防止和VC/.NET 之类的make命令冲突,并且把c:/mingw/bin目录中的XXX-make.EXE改成make.exe。然后在CMD中,执行一下 make.exe,如果是“*** No targets specified and no makefile found.   Stop.”那就对了。


现在测试你的编译器和make程序是否能正常工作。新建一个managed make C++   project(自动生成makefile),然后新建一个class文件,还是用helloworld的例子。我的文件内容如下:
---------
myclass.h
---------
#ifndef MYCLASS_H
#define MYCLASS_H

class myclass{
public:
int show();
myclass();
virtual ~myclass();
};

#endif // MYCLASS_H


--------
myclass.cpp
--------
#include "myclass.h"
#include "iostream"

using namespace std;

myclass::myclass()
{}
myclass::~myclass()
{}

int myclass::show(){
cout<<"hello world!"<<endl;
return 0;
}

int main()
{
myclass t;
t.show();
return 0;
}

10.保存程序,此时自动编译程序,如果没有错会自动在debug中生成一个exe程序。
11.然后点击工具栏上的run按钮,如图,为工程新建一个运行配置。

原创粉丝点击