Using eclipse CDT without creating a project

I am currently learning C ++. My first language was python. I use for coding in eclipse in pydev. I learn the language by writing a lot of code snippets and use the debugger extensively to understand what is actually happening. Now I have downloaded the CDT for eclipse since I am used to the interface.

But now I have to create a project for every C ++ file that I write. I want to quickly execute files (very small, no more than 300 lines) quickly and without creating new projects again and again. Any ideas? I am currently using eclipse as a text editor and am using g ++ to compile files.

+6
c ++ eclipse
source share
1 answer

I suggest you create one project containing all your files (provided that each of them has its own main function), and inside this project create an “Assembly Configuration" for each program, using:

Project> Properties> C / C ++ Build> Configuration> Management ...> New

To avoid multiple definitions of main in each build configuration, you will have to exclude each cpp file from the "Build Configuration" in which it does not belong. To do this, in the "Navigator" view:

Right-click the cpp> Properties> C / C ++ Build file and select the "Exclude from assembly" check box for each assembly configuration that the source file does not belong to.

When everything compiles fine, you can run or debug each program separately in Eclipse, choosing the appropriate build configuration.
Further information in this answer:
What files belong to the build target in a managed CDT build?

Hope this helps!

+6
source share

All Articles