Eclipse环境安装C/C++插件CDT
准备软件下载地址:
eclipse: http://www.eclipse.org/ 或 http://www.eclipse.org/downloads/
jdk-download: http://www.oracle.com/technetwork/java/javase/archive-139210.html
jdk-chm-help: https://docs.oracle.com/javase/8/docs/api/
MinGW:http://www.mingw.org/download.shtml
GDB: http://www.gnu.org/software/gdb/download
注:Eclipse安装的插件卸载(删除):
-
eclipse菜单 -> Help -> Install New Software... -> 有下角的:What is already instead?点击!
-
installed Software列表查找(点击列表下边有解释可查看)删除,可以点击instation history按时间查找删除,选择之后点击Uninstall
-
弹框确认Finish……
注:下载eclipse的Java版安装cdt插件,eclipse依赖JRE运行环境需要安装JDK或者JRE!
或直接下载C/C++ 版本:Eclipse IDE for C/C++ Developers!
注:安装jdk或jre和eclipse步骤查看,文章后的备注附件!
1:安装CDT插件:
-
1:eclipse菜单 -> Help -> Install New Software... -> Work with (Add..)
-
Name:CDT
-
Location:http://download.eclipse.org/tools/cdt/releases/galileo
-
2:填入Name和Location后OK,CDT Main Features和CDT Optional Features自定义选择安装或者全选(注:安装步骤图:在文章后的备注附件!),
-
安装完成提示重启eclipse后,编写C/C++的插件CDT已经在eclipse IDE环境,安装好了!
2:安装MinGW[C/C++编译平台],GDB[C/C++调试平台]
-
1:MinGW安装(自定义)勾选g++、MinGW Make或C/C++或mingw32-base和mingw32-gcc-g++等,按需求安装;
-
注:MinGW各个版本的安装目录差别很大,请根据版本选择:安装的编译器和工具!
-
2:将MinGW的bin目录(D:\MinGW\bin)加入到windows系统变量Path中;
-
3:并将MinGW\bin\mingw32-make.exe改名为make.exe
-
4:下载安装GDB到MinGW的(D:\MinGW\)的安装主目录下!
请参考:windows下使用vim(gVim)和gcc(MinGW):C/C++/Fortran/ObjC/Ada Compiler
3:Eclipse CDT使用MinGW来进行编译设置:
-
eclipse菜单 -> Window -> Preferences -> C/C++-> New CDT project wizard ->Makefile Project
-
在Binary Parser中取消Elf Parser勾选PE Windows Parser!
-
到此:开发环境就建立ok!
注:问题:eclipse中没有MinGW GCC/Cross GCC/Cygwin GCC/linux GCC/MacOSX GCC/MinGW
GCC/Solaris GCC(编译器)
4:建立C/C++ Project:New -> Project -> C/C++ -> C Project 或 C++ Project:
代码:
c:
-
#include <stdio.h>
-
#include <stdlib.h>
-
-
void main(void) {
-
printf("welcome join to c!");
-
}
c++:
-
#include <iostream>
-
-
using namespace std;
-
-
int main() {
-
cout << "welcome join to c++!" << end;
-
-
return 0;
-
}
5:测试:
welcome join to c!
welcome join to c++!
备注附件:
1:安装jdk或jre和eclipse步骤
-
a:Jdk或Jre直接Next默认路径安装(推荐)即可:
-
例如:jdk-8u60-windows-x64.exe!
-
b:配置windows的环境变量:
-
注:变量名(N)=变量值(V)
-
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_60
-
CLASSPATH = %JAVA_HOME%\lib;.%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
-
Path = %JAVA_HOME%\bin;
-
注:一般推荐Jdk默认C盘路径安装,并且Path配置最前!
-
c:jdk或jre安装成功后,解压eclipse到,然后运行:eclipse.exe!
2:Eclipse安装CDT插件:
Next >
Next >
Finish……
问题:MinGW+Eclipse开发C++程序时控制台Console没有输出
解决:windows的系统变量Path:D:\MinGW\bin,为MinGW安装路径的bin目录!
还不行,则
eclipse的run configurations,设置Environment添加:Path为D:\MinGW\bin