Friday, August 24, 2012

Getting Eclipse to Work with MinGW C/C++ Compilers

Eclipse is one of my favorite programming environment which is used to develop C, C++ and/or Java software efficiently. Let's set up Eclipse so that we can use it to work with MinGW C/C++ compiler and Java.




  1. First, install MinGW (as shown in this post). You have two choices for the MinGW compiler:




    I prefer the original MinGW compiler to MinGW-w64, but individual tastes may vary. Make sure that you add the folder containing gcc.exe to the PATH environment variable.




  2. Then, install JRE because Eclipse won't run without it. If you want to develop Java, then install JDK (Java SE or Java EE) instead of JRE.



  3. Now, download Eclipse IDE for C/C++ Developers (eclipse-cpp-juno-win32.zip) and unpack it. You need it to develop C/C++ programs.



  4. If you also want to develop Java, then download Eclipse IDE for Java Developers (eclipse-java-juno-win32.zip). Just unpack the Java Developer package into the same folder as Eclipse for C/C++, avoiding to overwrite existing files.



  5. Create a shortcut on your desktop that points to the Eclipse program (eclipse.exe). To start Eclipse, double-click the Eclipse shortcut that you just created.



  6. Let's test our Eclipse installation and create a simple C++ program. Start a new C++ project (File->New->C++ Project). Type in any Project name, and select Empty Project under Executable Project types. Choose MinGW GCC for toolchains. Click Finish.




    Once a new C++ project is open, create a new source file (File->New->Source File).




    Try typing in a simple code like the following:


    #include <iostream>
    using namespace std;

    int main()
    {
    cout << "Hello, boys and girls.\n";
    return 0;
    }


    Save the project (File->Save). Build the project (Project->Build Project). If the build was successful, run the generated program (Run->Run, or Ctrl+F11).


No comments:

Post a Comment

About This Blog

KBlog logo This blog seeks to provide a collection of interesting pictures found on the Web. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

Powered By Blogger