Win XP / Win 7上配置eclipse+CDT+MinGW,和相关问题的解决办法

软件的版本如下:

Windows XP SP3

JDK: 1.6.0_25
Eclipse: 3.6.2
ADT: 11.0.0
CDT: cdt-master-7.0.2
MinGW: 4.6.2
gcc: 4.6.2

我的安装顺序是: JDK, eclipse, ADT, MinGW, CDT.
暂时只提MinGW和CDT这两步的安装,之前的已经装好了。

1. 安装MinGW,指定路径为"C:\MinGW"
配置Mingw环境变量(很重要)
PATH变量,最前面加:"C:\MinGW\bin;"
C_INCLUDE_PATH = C:\MinGW\include
CPLUS_INCLUDE_PATH = C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++"; //Search for iostream to get this path.

2. 解压cdt-master-7.0.2,把features, plugins文件夹里的文件分别拷到对应的eclipse的文件夹里。
In this folder "D:\Program Files\eclipse\plugins"
Decompress the package org.eclipse.cdt.core.win32_5.2.0.201102110609.jar and then delete it.

遇到的问题Problems:
1. When helloWorld C/C++, "Unresolved inclusion: <stdio.h>"?
A: The compiler Eclipse is using is able to resolve the symbols just fine, so the code will compile fine.
But the code-completion/preprocessor Eclipse is using doesn't know where stdio.h exists.
You need to specify the filesystem path where stdio.h is located.
Properties -> C/C++ General and select Paths and Symbols

2. While compiling, there's error as following:
Internal Builder is used for build …………
Error: Cannot run program "gcc": ????????
A: D:\Program Files\eclipse\plugins
Decompress the package org.eclipse.cdt.core.win32_5.2.0.201102110609.jar and then delete it.

3. cout或者printf在eclipse的Console窗口没有输出显示,在cmd窗口运行是有输出的。The program simply terminates without any output. If i open up the .exe in a cmd window, it runs perfectly fine.
A: 1, Goto Project->Properties->Run/Debug Settings, choose the .exe file and press "Edit"
2, In the "Environment" tag, press "New", set it as: 
"Name:PATH"
"Value:C:\MinGW\bin"
还有人给出了这样的解决办法,不过我这貌似不管用。
I fixed the problem on my win 7 x64 PC. In the Eclipse window go to Preferences > C/C++ (Expand it) > Environment > Add:
"Name:PATH"
"Value:C:\MinGW\bin"

--------------- 下面才是Android相关开发的配置:

1. 安装JDK

运行JDK安装包。比如jdk-6u25-windows-i586。 

我的电脑”->属性->高级->环境变量

1) 系统变量->新建->变量名:JAVA_HOME 变量值:如,C:\Program Files\Java\jdk1.6.0_25。

2) 系统变量->编辑->变量名:Path 在变量值的最前面加上:%JAVA_HOME%\bin;(若已经有Path项,无须另外新建,直接在后面加,但需用;与前面已有的项分隔开)

3) 系统变量->新建->变量名:CLASSPATH 变量值:

.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;

 

然后cmd打开命令行输入javac查看是否已经成功。

 

2. 安装eclipse

直接解压安装包到目录D:\Program Files\eclipse即可。

下载地址:http://www.eclipse.org/downloads/ 

为了下面的步骤可以顺利,给eclipse的网络连接设置proxy:

Eclipse的版本不同设置代理的方法也不尽相同:

方法1.Preferences->General->Network Connections->Manual Proxy Configuration, set Http proxy is OK.

Edit and fill in: 127.0.0.1, port: 8087

方法2.window->preferences->Install/Update:Proxy Settings(新版本这个已经不见了)

然后,如果Android SDK Manager需要更新列表,也可以设置: Tools -> Options -> Proxy。

3. 安装ADT(Android Development Tools)

1.在线安装

1).打开Eclipse,Help ->Install New Software... ->选择Work with:后的Add...
2).Name选项输入Plugin名字,在Location输入https://dl-ssl.google.com/Android/eclipse/,点击OK,然后在Available Software”里勾选Name中的选项即可。(If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).)

2.离线安装

1).打开Eclipse,Help ->Install New Software... ->选择Work with:后的Add...
2). Name选项输入Plugin名字,在Location中选中本地Plugin压缩包,点击OK,然后在Available Software”里勾选Name中的选项即可。如果已经是最新的,uncheck update。

官方指导: http://developer.android.com/sdk/installing/installing-adt.html,里面有包的下载地址: http://dl.google.com/android/ADT-22.0.5.zip

4. 安装配置Putty

Putty: 直接运行,不需安装。

Putty.exe拷至桌面即可用。

可通过如下方法修改并保存putty配置,比如这里解决putty中文显示乱码问题:

1, 在第一个画面 (Session)请点选你要设定的Session,再按一下旁边的 Load,就可以把相关组态档读取进来。(切记这步不可跳过。)

2, 然后修改Window->Translation里面的character set,把它修改为UTF-8。

5. 安装Git,  连接Gerrit

Git: 

注意:在安装TortoiseGit-1.7.6.0-32bit的时候,务必在Choose a kind of SSH Client这一步选择OpenSSH Git default SSH Client,不然在Git Clone的时候会出错。

刷机工具\Git中的两个安装包都装好(推荐)。或在//code.google.com/p/msysgit/downloads/list下载git安装包。

 

6. 安装其他工具

source insight

beyond compare

ultraedit: 无需安装,解压即可用。

SqliteSpy: 无需安装,解压即可用。

-------

再记录一下upgrade及adt更新后的问题的解决方法:

把jdk降到1.6试试。

 

在插件列表就可以删掉或更新adt。

把workspace 里的.metadata文件夹删掉(貌似android特定问题的唯一解决办法,但是删掉之后要重新配置)。(适用于android SDK 的列表无法,提示 praseSDKContent失败,NullPointer...)

删除文件夹 C:\Documents and Settings\covics\.android 网上一般就只有这一步,为的是删除AVD的镜像文件。

其实我觉得更新的问题设置proxy也许就能解决?

============================================

后记:

Win 7 上用64位的eclipse,开始用eclipse-jee-kepler-SR1-win32-x86_64.zip,没有内置xml editer,update也不行。

XML tool Veloeclipse: Eclipse Software Updates URL: http://veloeclipse.googlecode.com/svn/trunk/update/

后来考虑到喜欢用adt,用了adt-bundle-windows-x86_64-20131030.zip,没有内置cvs client,update方法如下:

http://stackoverflow.com/questions/15262826/eclipse-android-adt-bundle-missing-cvs

Yes you can fix it. I don't know whether its default or not. But you can just fix it by installing it. Just go to help menu and click install new software if the version is indigo you will have a link with indigo and with respective names for other versions. Wait till it loads and in the type filter text type as cvs and wait. After you get that just install and restart. know more here.Yes you can fix it. I don't know whether its default or not. But you can just fix it by installing it. Just go to help menu and click install new software if the version is indigo you will have a link with indigo and with respective names for other versions. Wait till it loads and in the type filter text type as cvs and wait. After you get that just install and restart. know more herehttp://www.eclipse.org/eclipse/platform-cvs/.

OR:

On my ADT Bundle, under Help -> Install New Software...

I choose "Work with:" Juno

(I think Indigo is the previous release)

You should see a "Collaboration" section and in there is the "Eclipse CVS Client"

Select that and click next a couple of times. Agree to the T&Cs and it will install.

After a restart, you can find the "CVS Repository Exploring" perspective underthe "Window" menu.

Note: After installing this myself, I noticed that it changed the appearance of the Eclipse workspace and I had to re-open all the files I had previously set up."

---------- 【转】问题解决:The project cannot be built until build path errors are resolved 

From: http://blog.csdn.net/marty_zhu/article/details/2566299

1,看看project -- Build Automatically有没有勾上?如果没有,勾上以后,clean一下,重启eclipse

2,看看你的lib里面有没有不用的jar包,看你的.classpath文件中有没有错误的路径.

3,这是最重要的一点,有problems视图中查看有没有关于本项目的错误信息,一般都会有这样的话:      The project cannot be built until build path errors are resolved 然后下面提示unbound classpath, 一般在.classpath中删除这些path就可以了

4. 安装Tomcat后,确保{tomcat_home}/common/lib文件夹下有jasper-runtime.jar、jsp-api.jar、servlet-api.jar、jndi.jar几个文件。启动Eclipse,第一次启动会有一个配置过程,选择菜单上的window/preferences,选java/classpath variables,New添加一个名为JDK_TOOLS并指向你的{jdk_home}/lib/tools.jar的环境变量。

(注:我碰到这个问题update了一下有问题那部分代码,然后神奇的就好了。)

---------------------

原文地址:https://www.cnblogs.com/lionfight/p/2603823.html