- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
- C++ Advanced
- C++ Files and Streams
- C++ Exception Handling
- C++ Dynamic Memory
- C++ Namespaces
- C++ Templates
- C++ Preprocessor
- C++ Signal Handling
- C++ Multithreading
- C++ Web Programming
How do I set up C/C++ on Eclipse in Windows?
Step 1 − Install MinGW GCC or Cygwin GCC
To use Eclipse for C/C++ programming, you need a C/C++ compiler. On Windows, you could install either MinGW GCC or Cygwin GCC. Choose MinGW if you are not sure, because MinGW is lighter and easier to install, but has fewer features.
To install MinGW, go to the MinGW homepage, www.mingw.org, and follow the link to the MinGW download page. Download the latest version of the MinGW installation program which should be named MinGW <version>.exe.
While installing MinGW, at a minimum, you must install gcc-core, gcc-g++, binutils, and the MinGW runtime, but you may wish to install more.
Add the bin subdirectory of your MinGW installation to your PATH environment variable so that you can specify these tools on the command line by their simple names.
Step 2− Install Eclipse C/C++ Development Tool (CDT)
Two ways to install CDT, depending on whether you have previously installed an Eclipse:
If you have already installed "Eclipse for Java Developers" or other Eclipse packages, you could install the CDT plug-in as follows:
Launch Eclipse → Help → Install New Software → In "Work with" field, pull down the drop-down menu and select "Kepler - http://download.eclipse.org/releases/kepler" (or juno for Eclipse 4.2; or helios for Eclipse 3.7).
In "Name" box, expand "Programming Language" node ⇒ Check "C/C++ Development Tools" ⇒ "Next" ⇒ ... ⇒ "Finish".
If you have not install any Eclipse package, you could download "Eclipse IDE for C/C++ Developers" from http://www.eclipse.org/downloads, and unzip the downloaded file into a directory of your choice.
Step 3− Configuration
You do NOT need to do any configuration, as long as the Cygwin or MinGW binaries are included in the PATH environment variable. CDT searches the PATH to discover the C/C++ compilers.
Your eclipse is now ready to run C++. In order to test it, open Eclipse. Now choose File → New → Project → C/C++ project. In "Toolchains" box, choose your compiler, e.g., "Cygwin GCC" or "MinGW GCC" ⇒ Next.
Create a new file and Write some C++ code in the file. Right-click the project and select Build Project. Finally, right-click the project and select run as and then Local C/C++ application. This should run your application.
If you face any difficulties in installing/running the project, please visit https://www3.ntu.edu.sg/home/ehchua/programming/howto/EclipseCpp_HowTo.html for much more detailed instructions.
- Related Articles
- How to install JDK in Windows and set up the environment variables?
- How to Install C++ Compiler on Windows?
- What environment variables do I need to set up before I start running Java programs on my machine?
- How to set your python path on Windows?
- How do I create child windows with Python tkinter?
- How do I run a Python program under Windows?
- How to compile and execute C# programs on Windows?
- How to set python environment variable PYTHONPATH on Windows?
- How do I use arrays in C++?
- How can I view the indexes I have set up in MySQL?
- How do I catch a Ctrl+C event in C++?
- How do I use the conditional operator in C/C++?
- How do I close all the open pyplot windows (Matplotlib)?
- How to Set-Up Shiny Server on Ubuntu
- How do you set, clear, and toggle a bit in C/C++?