I am currently learning c++.My first language was python.I am used to coding in eclipse in pydev. I learn a language by writing a lot of code snippets and use the debugge开发者_StackOverflowr extensively to understand what is actually happening. Now,I downloaded CDT for eclipse,since I am used to the interface.
But now,I am forced to create a project for every c++ file I write. I want a way to easily execute the files(very small,max 300 lines) in fast manner,and without creating new projects again and again.Any ideas? Currently I use eclipse like a text editor,and use g++ for compiling the files.
I suggest you create one project containing all your files (assuming each one has its own main
function), and inside this project, create one 'Build configuration' per program by using :
Project > Properties > C/C++ Build > Configuration > Manage... > New
To avoid multiple definition of main
in each 'Build configuration', you will have to exclude each cpp file from the 'Build configurations' it doesn't belong to. For this, in the Navigator view :
Right click on the cpp file > Properties > C/C++ Build, and check 'Exclude from build' for each 'Build configuration' the source file does not belong to.
When everything compiles fine, you will be able to run or debug each program separately inside Eclipse by selecting the matching 'Build configuration'.
More info in this answer :
What files belong to a build target in CDT managed build?
I hope this will help!
精彩评论