How to deal with Eclipse CDT+Cygwin?
Solution 1
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.
Solution 2
Did you try this Eclipse CDT and Cygwin tutorial for C++?
Solution 3
Have you checcked which Binary parser are you using?
Right click on your project, Properties, C/C++ Build, Settings, Binary Parsers tab, select PE Windows Parser if you are using Windows OS or Elf Parser for Linux OS.
Solution 4
I had similar error and what worked for me is below:
In the settings: 'Project|Properties|C/C++ General|Indexer'
, I unchecked 'Allow heuristic resolutions of includes'
and saved the settings. After rebuilding, all my errors like ''std' is ambiguous ...' disappeared.
Solution 5
Giving all basic steps to write hello world program with eclipse + CDT + cygwin-gcc.
You must have missed some steps from 3 to 7.
- Install cygwin with packages
binutils
,gcc-core
,gcc-g++
,gdb
andmake
. I earlier did not insalled any packages. So I installed the packages after installing cygwin. You can install them by rerunning cygwin's setup exe (Point 3 in this answer) or by usingapt-cyg
as described in this answer: - Install CDT plugin in eclipse or install CDT eclipse.
- Set windows
path
environment variable to include cygwin bin (C:\Program Files\cygwin\setup\bin
) and lib (C:\Program Files\cygwin\setup\lib
) directory paths. Set windowsclasspath
environment variable to include cygwin lib directory path. - Run commands
gcc
,g++
,gdb
andmake
in windows command prompt to check if the installed cygwin packages are reachable and are not giving command not found error. Forgcc
,g++
andmake
, it should give input or target file not found error. Forgdb
, it should startgdb
prompt, which you can escape by typingQuit
ingdb
prompt. - Start eclipse and do
File > New > C/C++ Project
- Select C/C++ Managed build:
ClickNext>
. - Give suitable project name. Select
Cygwin GCC
in toolchain:
It should create new project and include desired header files from cygwin lib directory specified in environment variables:
- Right click on the project created in project explorer > hover on New in context menu > click Source Folder. Give name
src
to new source folder.
- Right click on source folder and add new C source file
HelloWorld.c
: - Right click on the project and select Build Project. It should create debug files and executable binaries:
- Right click on open c file,
Run as > Local C/C++ Application
. It should run the executable generated in earlier step.
user1377046
Updated on September 15, 2020Comments
-
user1377046 almost 4 years
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.
-
Amit Ruhela about 4 yearsStep 7 not clear. The include files/folders are truncated.
-
Mahesha999 about 4 yearsOnly first screen shot in the step 7 describes the action to be performed in that step. Second screen shot shows effect of performing the action. Cropped part of 2nd image shouldnt be an issue.