Inner-Workings of a Software Mind
Saturday, November 12, 2005
  HOW TO: Use CDT and MinGW for Eclipse (i.e. develop C/C++ applications in windows)
I've made these instructions due to the difficulty of finding any documentation that was sufficient enough to help me setup Eclipse using MinGW on Windows. I would recommend using MinGW because of the higher success rate and better compability issues for C/C++. If there are any errors or questions please leave comments.

Step 1:

Download MinGW from mingw.org the following:

Step 2:

Extract the files to the following directory c:\mingw\ and install mingw32-make-3.80.0-3.exe to c:\mingw\.

Step 3:

Add c:\mingw\ to the Paths in System Variables of Environment Paths. Make sure you can run gcc -v in the command prompt.

Step 4:

Install CDT for Eclipse using Help-> Software Updates -> Find and Install -> Search for new Features to Install. Add a new remote site with name "CDT" and URL "http://download.eclipse.org/tools/cdt/releases/eclipse3.1". Accept the license agreements to install both CDT packages.

Step 5:

Create a new Managed Make C Project named "Hello World". I prefer managed make because I like the IDE to worry about the details of a make file.

Step 6:

Create a file called main.c with the following contents:

#include "iostream"
#include "string"
using namespace std;

int main()
{
string yourName;

cout << "Enter your name: ";
cin >> yourName;
cout << "Hello " + yourName << endl;
return 0;
}

Step 6:

You should see an error in the console view. Go to the properties menu for the "Hello World" project and Select C/C++ Build. In the Tool Settings tab, for GCC C compiler and GCC C Linker, set the command to "C:\mingw\bin\mingw32-g++.exe ". In the Build Settings tab, uncheck "use default command" for the build command, and replace the command with "C:\mingw\bin\mingw32-make.exe -k". Also change the Artifact name to "HelloWorld". Press OK.

Step 7:

You should now see a screen like the following in the console (click to enlarge):



Step 8:

There should also be a binaries folder that contains "HelloWorld.exe." Run the program by clicking on Run -> Run... Then click on C/C++ Local Applications and click new. Browse for the "Hello World" project and click on "Search project..." to find "HelloWorld.exe". Click Run.

Step 9:

You should a screen like the following in the console, after you finished running the application:

 
Comments: «Oldest ‹Older 601 – 342 of 342 «Oldest ‹Older 601 – 342 of 342 Post a Comment

Subscribe to Post Comments [Atom]





<< Home

Archives
October 2004 / May 2005 / June 2005 / July 2005 / August 2005 / September 2005 / October 2005 / November 2005 / March 2006 / May 2007 / September 2007 / September 2009 / December 2009 / February 2011 /


Powered by Blogger

Subscribe to
Posts [Atom]