For a newer version of this document, see the Introduction section
If you have followed these instructions everything should work. However, you may have ran into trouble, and then decided to look for the manual (at least, that's the way I would have done it). So now you have a problem and need an answer:
Please note if you are reading the online version: Some problems may covered in a newer version of this document, please refer to the section called “Introduction”.
Make sure you have done the following things:
Installed the CDT
Installed (not just downloaded) MinGW
Installed (not just downloaded) MSYS
Set up your path environment variable
Especially made sure you did the last step. You will need to restart eclipse (full restart with shutdown, File / Restart is not sufficient). This solves about 99% of all support mails I've got so far.
You have just tried the build the hello world program, and you get this error message instead of an executable. This means that make is not in your path. Open up a command prompt (In OS X: Terminal in Applications/Utilities, in Windows: Start/Run, type in cmd) and type in make. If that doesn't work, try gmake.
If gmake worked, see the section called “Configuring the CDT”.
To check your path (on windows), open up cmd and type in echo %path%. This should show the path to MSYS and MinGW. Also, make sure that you restarted Eclipse (or cmd if you are testing) after setting your path.
If you are on Windows, and you have installed MinGW, but not MSYS, you may have an executable called mingw-make. In this case you have to go to the section called “Configuring the CDT” and configure appropriately. It is possible to just use mingw-make and no MSYS at all, however, mingw-make has some limitations. Eclipse CDT managed makefiles may or may not work with it. Please see the MinGW FAQ for more information.
This error message means that g++ is either not installed or not in your path. Check your path settings as described in the section called “Build error (Exec error:Launching failed), CreateProcess: make -k all error=2,”, but this time try the commands: gcc --version and g++ --version. If gcc works, but g++ doesn't, it means you have only installed the C and not the C++ version of the gcc compiler, which happens quite frequently on Linux distributions. Check if you have all needed packages installed, and check the section called “Setting up a compiler”.
If you are on windows, and neither of them worked, install MinGW and set your path environment variable. If only gcc one worked, reinstall MinGW and don't forget to select the C++ compiler!
If you are on windows and use Eclipse 3.1 with CDT 3.0.0 there is a bug. See the section called “Configuring the CDT”.
Please note that debug sessions in Windows have their own console window (a black console window) and do not appear in the regular Eclipse console. If you're running a debug session, please watch which windows appear in your task bar.
If you followed these instructions you have installed MSYS instead of cygwin. You may safely ignore this error message.
You have not installed the CDT. See the section called “Installing the CDT”.
Every time I start Eclipse on my laptop, I can only compile and run a program once. After that it asks if I want to run it with errors every time. The compiler says this:
Building target: Project01Test.exe Invoking: GCC C++ Linker g++ -oProject01Test.exe ./test.o C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot open output file Project01Test.exe: Permission denied collect2: ld returned 1 exit status make: *** [Project01Test.exe] Error 1 make: Target `all' not remade because of errors. Build complete for project Project01Test
Answer: Your program may still be running. Try stopping it by using the small red square on the console window (the one for your program). Another way is switching to the "Debug" perspective, selecting your running program, and stopping it there (also the small red square).
Unfortunately gdb is not included in the current (4.1.1 or 5.0.2) version of MinGW. See the section called “GDB (optional!)”.
Make sure you are using the make programs provided by MinGW. If your output in the console shows something like:
make -k clean all MAKE Version 5.2 Copyright (c) 1987, 2000 Borland Incorrect command line argument: -k
Then you have make installed from a previous installation of Borland C++. You have several choices:
Adjust your PATH environment variable to have the MinGW / MSYS installation come before Borlands tools. Please be warned that this may break your Borland tools!
Remove the path to the Borland tools from your PATH. This will definitely break your Borland tools.
Download "mingw32-make". This is an option when installing MinGW. Make sure you set your make setting to be "mingw32-make". If you still get an error, try setting it for the build settings in your project. In this case you may even skip the installation of MSYS, but you will get limited functionality.
There are several possible reasons for that:
If you have no binaries folder, then two things may have happened
You are not looking at the C/C++ Project view. Make sure you are in the C++ perspective and "C/C++ Projects" is active. An example of this situation is shown in Figure 27, “The Navigator view instead of the C/C++ Projects view”: Click on "C/C++ Projects" to fix.
Your program didn't compile. Check the output of the "Console" Window. It is either an error in your program or a configuration error. For configuration errors, check the other problems.
If you do have a binaries folder, then make sure you run you program by right-clicking (on the mac: hold down ctrl and click) on the binary, and then selecting Run / Run as C/C++ Application. Just hitting the run button will only work after you have done that at least once!
This problem happens on Windows when you moved Eclipse out of its directory instead of creating a shortcut. Please move it back into the Eclipse directory, then drag'n'drop it using the right mouse button, where you can select "Create Shurtcut"
I personally do not recommend the installation of cygwin, but rather the installation of MinGW and MSYS as described in the section called “Windows compiler”. However, the following problems have been reported by users:
Eclipse prefers to use cygwin if it is installed, and will do everything to manipulate the path to include cygwin if it is installed. Binaries will therefore by default be linked against the cygwin libraries. Possible workarounds:
-mno-cygwinto your compiler settings
Overwrite the path variable in eclipse: In the Project Properties: C/C++ Build -> Environment -> User Variables -> New. Select PATH, remove the cygwin directory and select Replace as Operation.
Your workspace or your eclipse installation may use a path with
includes spaces, such as
Settings. Eclipse sometimes fails in this case. Try
creating your workspace in a different directory.
If you read the online version of this document, check out the section called “Introduction”. You problem may of this document.
If you are still having trouble, you may try and send me an email. Please be aware that I may not respond to every email, as I am doing this support mainly as a hobby (unless you're in my class). Make sure your email includes the following. Please send the complete output!
The contents of your PATH environment variable (in Windows: echo %PATH%. In Linux / Mac OS X: echo $PATH).
Version of GCC you're using (gcc --version)
Version of Make you're using (make --version or gmake --version)
Version of Eclipse you're using
Version of the CDT you're using
The complete output of your "Console" window (at the bottom of eclipse) when your error occurs.
The steps you did so before the problem occurred.
For a newer version of this document, see the Introduction section