10

I have cygwin installed, and I want to use Eclipse with CDT for development under Windows 7. However, I get following error:

**** Build of configuration Default for project hello_cpp ****

make all 
g++ -O2 -g -Wall -fmessage-length=0   -c -o hello_cpp.o hello_cpp.cpp
process_begin: CreateProcess(C:\cygwin\bin\g++.exe, g++ -O2 -g -Wall -fmessage-length=0 -c -o hello_cpp.o hello_cpp.cpp, ...) failed.
make (e=5): Access denied.

make: *** [hello_cpp.o] Error 5

**** Build Finished ****
  • I'm able to use g++ as standalone compiler.
  • cygwin /bin folder is added to path.

After googling I found out that C:\cygwin\bin\g++.exe is a cygwin symbolic link and Windows doesn't understand it and I need to point to the g++-3 location directly. How do I do it?

  • do a "ls -l C:\cygwin\bin\g++.exe" and from the output ( A -> B ) copy B as actual location. – FUD Dec 12 '11 at 04:07
  • I don't really understand how to configure eclipse(or make) to execute the right command. –  Dec 12 '11 at 06:20

3 Answers3

11

I think you've done something wrong and need to start over again. Just installed Cygwin and Eclipse CDT (Indigo) on my Windows 7 and all works fine and auto-magicaly for me.

Here's what I did and I think you need to do:

  1. Get the latest Cygwin (yes, get it again! get rid of the old one just to be sure)
  2. During the installation make sure to select gcc, gcc-g++ and make (I additionally installed couple of other things like gcc4, w32api but it's optional)
  3. Start Cygwin terminal to init all configuration files, etc. See if g++ executes and close the terminal.
  4. Add C:\cygwin\bin (or wherever else you installed it) to your Environment PATH variable
  5. Get Eclipse CDT, extract it somewhere and start it up.
  6. Go to File -> New Project -> C++ Project and select Hello World C++ Project. You should see the Cygwin GCC in the Toolchains list. enter image description here
  7. Create the Project, build and run it!

Done!

Build output:

**** Build of configuration Debug for project TestApp ****

make all 
Building file: ../src/TestApp.cpp
Invoking: Cygwin C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/TestApp.d" -MT"src/TestApp.d" -o "src/TestApp.o" "../src/TestApp.cpp"
Finished building: ../src/TestApp.cpp

Building target: TestApp.exe
Invoking: Cygwin C++ Linker
g++  -o "TestApp.exe"  ./src/TestApp.o   
Finished building target: TestApp.exe

**** Build Finished ****
nowaq
  • 2,748
  • 19
  • 25
  • Just as a note, if you've already opened Eclipse, you'll need to close it and reopen before any changes to Environment PATH will take effect! – Patrick Nov 08 '13 at 10:40
1

You can go to

Project Properties Page > C / C++ Build > Settings > Tool Settings

And change the command as you want. Documentation here.

Bojangles
  • 99,427
  • 50
  • 170
  • 208
0

Refer this link, it shows how to setup eclipse for native development with ease. everything is done in eclipse except setting environment variables.

Hulk1991
  • 3,079
  • 13
  • 31
  • 46
Sony
  • 7,136
  • 5
  • 45
  • 68