且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

window下eclipse +cdt+cygwin做C,C++开发环境搭建 (转自:http://blog.csdn.net/thinkandchange/article/details/7935)

更新时间:2022-09-03 08:59:10



1.Cygwin下载,配置,参看本人ndk开发。

给cygwin配置环境变量;

2.eclipse for java,javaee的话再安装cdt插件,eclipse for c,c++不需要.

3.安装好后eclipse的配置问题.

新建工程:

window下eclipse +cdt+cygwin做C,C++开发环境搭建 (转自:http://blog.csdn.net/thinkandchange/article/details/7935)

注:

第一:选Executable 而不是上面的GNU Autotools

第二:如果右边没有 Cygwin GCC选项,先在gnu里新建一个工程,右击选择build configuration--managetion -> New -> Import predefined - > (Excutable -> Cygwin GCC)

eclipse c/c++开发代码提示

打开终端:输入:$ gcc- vUsing built-in specs.

得到类似的:
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2335.15~108/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2335.15~108/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
很容易就看到你当前使用的版本了。
启动Eclipse.进入:Windows-->Preferences-->C/C++找到Environment。增加两个变量:
CPLUS_INCLUDE_PATH: /usr/include/c++/4.2.1(我的gcc版本) 
C_INCLUDE_PATH: /usr/include
 
C/C++的代码提示只在.和->下触发,虽然没有Java下这么强大,不过也够了。因为这里是代码提示最容易发挥威力的地方。