Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deal with Eclipse CDT+Cygwin?

Recently I installed Eclipse Indigo Service Release 2(for JAVA EE) and installed CDT 8 online.Then I installed Cygwin with gcc,g++,gdb,make,binutils,automake,etc at the latest version.I had also made the environment variable PATH correct.

Making a new C++ project(using Cygwin GCC toolchain) is just fine,but after typing a HelloWorld program,it shows lots of errors and warings.

When using external builder,in error it shows

"Cannot run program "make": ?????????¨?".

When using internal builder,in conclose it shows

"g++ -IC:\cygwin\lib\gcc\i686-pc-cygwin\4.5.3\include\c++ -O0 -g3 -Wall -c -fmessage-length=0 -o src\test_cpp.o ..\src\test_cpp.cpp

Error: Cannot run program "g++": ?????????¨?

Build error occurred, build is stopped

In both Windows CMD and Cygwin Terminal,g++ and make both work well.

What's more,Eclipse can't find the including libraries,so I have to add the path C:\cygwin\lib\gcc\i686-pc-cygwin\4.5.3\include\c++ to the project properties->C/C++ Building->Settings.But after that, in error,it still shows,

'std' is ambiguous '

Invalid overload of 'endl'

Symbol 'cout' could not be resolved

In project properties->C/C++ Building->Discovery Options,I set the Discovery Profile scope as Configeration-wide and Discovery profile as GCC per file scanner info profile.

like image 265
user1377046 Avatar asked May 05 '12 16:05

user1377046


1 Answers

You have to setup a Cygwin toolchain, first of all install Cygwin with the following packages :

binutils
gcc
gcc-core
gcc-g++
gcc-mingw-core
gcc-mingw-g++
make

Add %cygwin%\bin to your PATH environment variable, then open Eclipse and Cygwin toolchain will be shown when you open a new c/cpp project wizard.

like image 124
aleroot Avatar answered Sep 17 '22 15:09

aleroot