The following is a basic overview for those getting started with C/C++ development in Eclipse. This is in the context of an importing an existing makefile project into Eclipse.
Setting up
- File > New > Project...
- C/C++ > C++ Project, hit next
- Makefile project*> Empty Project:
- Select Linux GCC toolchain
- Name your project
- Hit finish
- Right click the on project > Import...
- General > File System:
- Hit next, and browse for the assignment code
- Tick and include the folder which has the sub-folders src, assets, etc.
- Hit finish
General usage:
- Right click project > clean project
- Right click project > build, or hit the hammer button
- Right click > Run as > Local C/C++ Application
- Right click > Run as > Run configurations...
- Select your application (should be under C/C++ Application)
- In the Main tab, put the location of your output (e.g /build/AppName)
- In the Arguments tab, add your arguments, e.g assets/teapot.obj
- Hit Apply, then hit Run
Notes:
- Building does not save in Eclipse! Be sure to save before cleaning/building.
- Valgrind is a tool which is useful for memory debugging and testing for memory leaks. While it can be slow, it is useful. To use Valgrind:
- Right click project > Profiling Tools > Profile with Valgrind
- You might need to set the arguments in the Profiling Tools Configurations, just like we did in Run Configurations.
- When you're finished with your project, ensure that it can be ran from the command line. Tutors often run from the command line like so:
make clean
make
./build/AppName args