i am a beginner using eclipse CDT. usually in DEVc++ or other lightweight IDE\'s we can directly open and edit a single .cpp file from desktop and run it.
on the other h
I know eclipse has the ability to create a java scrap book, using this you can write a bit of java code and just run that code, with out having to setup any classes or main functions. You might want to look to see if eclipse has C++ scrap book in the New dialog box.
Eclipse is great. I love it, but you are right, there is too much burden with one-file projects. So maybe approach problem in different way:
Write code in Eclipse enjoying all IDE features.
Put all your one-file programs to single project. No, Eclipse won't compile them because of multiple main functions but...
Compile file from command line.
You can copy proper command line from Eclipse console when building project. You must be smart because you are playing topcoder so you figure out how to alter command line for your need. ;)
Assuming you dropped several .cpp
files in the same project (containing a main in each), you can :
.cpp
file and Properties > C/C++ build > Settings > Manage Configurations
.check
"exclude resource form build", for each one.unchecked
.play
Finally, to switch from one run configuration to another, go to Project > Properties > Manage Configurations
and change the active one. Rebuild and run.
EDIT: as shivi
mentioned, the most painful part (excluding resources form build) can be done in one single shot by multi-selecting the files to exclude in the Package Explorer
view and Right-click > Resource Configurations > Exclude from build...
.
That's the best we can do...
Use geany. It works out of the box with single C++ file. And it can run a custom make file if you need to modify your setting.
Create a new Folder (ex: tmplib)
Right click on "tmplib" -> Resource Configuration -> Exclude from build (debug and release)
Drag/drop files between src and "tmplib" folder - anything in src folder will be built (no need to delete src folder)
That's what I do. You can create a project called Coeforces for example, then you can create a folder inside the project called AC for example and right click on it --> Resource Configuration --> Exclude from build --> check both Debug and Release .
Then delete src folder. Whenever you finish a code just drag and drop it in the folder and then you can create a new source file directly in the project . Also you can create another folder called WA for example for problems that you couldn't solve and want to save the code in order to think again later.