wiki:COP3402Spring2011/InstallEclipseCpp

Version 2 (modified by steven.zittrower, 13 years ago) (diff)

--

Installing Eclipse for C/C++ = [[PageOutline]]

These are some step-by-step instructions on how to setup Eclipse for compiling C/C++ programs. If you prefer to use Visual Studio or any other IDE, you can simply ignore them :-) .

Depending on your operating system and Eclipse configuration there are multiple steps necessary to succeed.

By default, Eclipse will use the C/C++ GNU development tools to compile, link, and debug your programs. If you are running Linux and MacOS you shouldn't have a problem, as long as you have gcc, make, and gdb installed.

Under Windows, you have to install the GNU development tools, but fortunately there is an Eclipse extension called "Wascana" that takes care of that. See below for detailed instructions on how to acquire it. If you develop under Linux or MacOS, just skip the instructions on installing "Wascana".

If you already have Eclipse for Java installed and want to add the C/C++ functionality, please start reading here. If you prefer a new Eclipse installation, start reading here.

If you encounter any problems, please send me an e-mail ( rpillat@… ) or see me during my office hours.

If you already have Eclipse for Java installed

  • If Eclipse is installed somewhere in your user folder, simply launch the executable. Otherwise, make sure to right-click the executable and select "Run as administrator" (you will need write access to the Eclipse folder to install the new plugins).
  • Once the workspace opens, select "Help -> Install new software"
  • A new window opens. In the "Work with:" combobox, select the "Helios" repository.
  • There will be a list of available packages. You are only interested in the "Programming Languages -> C/C++ Development Tools" software. Select the checkbox in front of it

  • Now hit the "Next" button, accept the license terms and click "Finish".
  • Eclipse will ask you to restart, so please do so.
  • Now we have to install one more package. Once the workspace opens, select "Help -> Install new software" (for the second time ;-) )
  • In the upper-right corner click the "Add" button.
  • In the new "Add repository" window, enter "Wascana" under "Name" and "http://svn.codespot.com/a/eclipselabs.org/wascana/repo" under "Location". Click the OK button.

  • Eclipse will now add "Wascana C/C++ Developer for Windows" to the list of available software. Mark the checkbox in front of that.

  • Now hit the "Next" button twice, accept the license terms and click "Finish".
  • Eclipse will ask you to restart, so please do so.

If you prefer a new Eclipse installation

  • Once the workspace opens, select "Help -> Install new software"
  • A new window opens. In the upper-right corner click the "Add" button.
  • In the new "Add repository" window, enter "Wascana" under "Name" and "http://svn.codespot.com/a/eclipselabs.org/wascana/repo" under "Location". Click the OK button.

  • Eclipse will now add "Wascana C/C++ Developer for Windows" to the list of available software. Mark the checkbox in front of that.

  • Now hit the "Next" button twice, accept the license terms and click "Finish".
  • Eclipse will ask you to restart, so please do so.

Compilers: MinGW vs. Wascana

  • Wascana is no longer supported, while it can still be installed and used the developers recommend using MinGW for Windows based systems. Detailed instructions on installing this compiler can be found here. Setting Up a Compiler.
  • Linux/Unix should come with a built in compiler. You can check if it is installed by running the command g++ --version and make --version
  • Mac OS X may or may not have a compiler installed on it already. You can try the above command to see if the Gnu compiler is installed. If no you'll need to install the developer tools. Instructions for this can be found at the above link.

Creating a new C/C++ project

  • From the menu select "File -> New -> C++ Project" (or "C Project" if you prefer). If these options don't show up, try to find them under "File -> New -> Other -> C/C++". A wizard for a new project will open. Enter an appropriate name and select "Hello World C++ project".

  • Click "Finish" and you are the proud author of a C++ HelloWorld project. It's a simple project that only prints out a greeting to the console when you run it.
  • To build the project click the hammer symbol, to run it the play button, and to debug it the little bug.

Attachments (5)

Download all attachments as: .zip