Eclipse IDE for Java C CPP on Windows 7
- install JRE (64 bit)
- install Eclipse CDT (64 bit)
- install Wascana (mingw for eclipse)
- configure the path variable
A pre-requisite is to download the JRE (Java Runtime Environment, 5.0 or higher, newer is often better).
FIRST, check if you have a 64 bit or older 32 bit system.
If you have a 64 bit system, use a "64 bit browser" to go to the java page because otherwise it will keep giving you the 32 bit version to download... http://www.java.com/en/download/faq/java_win64bit.xml The link and filename should be something like: "jre-6u22-windows-x64.exe"
Otherwise you'll get exit code=13 or "failed to load the JNI shared library"...
This will most likely install in C:\Program Files\Java (or some variant). The key is to have the C:\Program Files (x86)\Java\jre6\bin\javaw.exe file (and .dll's etc.)
The Base CDT supports integration with the GNU toolchain but may not come with the compiler...
All Linux distributions include the GNU toolchain (but might not be installed by default...) MinGW provides the best integration support with the CDT due to it's direct support for the Windows environment.
If you download the Eclipse IDE for C/C++ you'll get the "CDT" plugins along with the default Eclipse platform:
http://www.eclipse.org/cdt/downloads.php
The eclipse.ini file allows you to configure your program (e.g. specify the JRE location) (Notedpad2 or notepad++ handle the linux versus windows line breaks transparently...) e.g. insert the line to specify where your java run time environment is, maybe you have two...
-vm C:\Java\jre6\bin\javaw.exe
Double clicking the eclipse.exe icon will start it with an empty Workbench (and use the default JRE) (The first time you will be given the opportunity to choose your "Workspace" (aka directory where all of your files will be stored, I prefer to have it in the Eclipse folder but obviously in a multi user setup the "My Docs" or Network Folder would also make sense... or Oxygen Cloud / Dropbox? DropBox -> Public might make Open Source Distribution even easier? )
File -> New -> C Project
Fill in the basics (you can choose the pre-made hello world app) Then click on the "Go To Workbench" so you can see the Project File Explorer, Code Editor, Console (NOTE Window -> Preferences allows you to customize Eclipse e.g. disable usage statistics)
Click on the hammer symbol (Build) to ensure that you create an object file before trying to test run an executable...
Of course when you try to build you get an error...
Internal Builder: Cannot run program "gcc" (in directory "C:\My Dropbox\workspace\hello\Debug"): CreateProcess error=2, The system cannot find the file specified Build error occurred, build is stopped
Help -> Install New Software (previously Software Installer)
Work With gets pasted the URL of the Wascana C/C++ compiler for Eclipse, then click ADD http://svn.codespot.com/a/eclipselabs.org/wascana/repo
Click on the Checkbox for "Wascana C/C++ Developer for Windows, then NEXT (review items to be installed, e.g. wascana.core) NEXT, then Agree to the License Terms...
After it downloads, installs, and restarts Eclipse you'll find the new mingw and msys directories in your Eclipse folder.
Now you have to update the Path, in Windows it's usually under System Properties > Advanced System Settings Environment Variables -> System Variables scroll area, highlight "Path" (click on the edit button)
It should already have something like: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
Append a semi colon to continue the long list and add: c:\eclipse\mingw\bin
(Apparently some people feel eclipse does not autodetect unless it's c:\mingw)
Unfortunately it's a fundamental flaw - even when using Eclipse 64 bit the Install New Software gets the Wascana 32 bit mingw gcc.
The Workaround is to use the Wascana Desktop as a single download / install (which includes 32 bit versions of: JRE 1.6.0 , Mingw 3.4.5 , Eclipse IDE)