-
Creating a new C/C++ Project into Eclipse
-
Start up Eclipse (e.g. on Linux just run 'eclipse' in the Terminal)
-
Go to File->New->Project.
-
From the New Project Dialog, select C/C++ -> C++ Project:
-
Click Next, to continue onto the next screen.
-
Give your project a name and select the "Hello World C++ Project" option listed underneath "Executable," e.g.:
-
Click Finish to proceed to the actual project viewer. You'll start out with a simple "Hello World" program, which you'll probably want to edit or remove. From there on - managing and building code should be quite similar to development in Java. Enjoy!
-
Linking Against Libraries
-
To link in additional libraries, go to Project->Properties. On the left-hand side select C/C++ Build -> Settings. On the right-side, under Tool Settings, selecting GCC C++ Linker->Libraries gives an interface for adding and removing libraries, e.g.:
-
If you're writing an OpenGL program on Linux, make sure that "GL" and "glut" have been added.
Importing a Project into Eclipse
-
After starting up Eclipse, select File->Import and select "General -> Existing Projects into Workspace", e.g.:
-
Click next when you're done. In the new dialog, you'll be able to specify the location of your project directory via the "Select root directory" field. After doing so, click "Finish" to get to the actual project viewer.
Debugging in Eclipse
-
To debug your executable in Eclipse go to "Run->Debug As->Local C++ Application." If it's your first time debugging, you'll be prompted by a dialog window and asked to choose a Launcher. Check the "Use configuration specific settings" and select the first launcher "GDB (DSF) Create Process Launcher," e.g.:
-
Click OK to continue.
-
Eclipse will ask you if you want to open up the "debug" perspective. Clicking yes will take you to a window panel similar to the following:
-
The most interesting information is shown via the top two panels. The top-left shows the current stacktrace of the running program, and provides buttons for continuing, terminating, and stepping through the code. The top-right panel shows variables and their contents for the current frame.