News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

How to run / debug a single file (without a project)

Started by danizobin, March 16, 2008, 12:26:18 AM

Previous topic - Next topic

danizobin

BS"D

When I just open a file, without a project context, almost all the options under "build", "debug" are graid out.

Any ideas?

Thanks,
Dani

DrewBoo

Aside from holding a bunch of files together, a project contains important information about what it means to "build" that project.  Things like what the built program should be named, where it should go, where header files can be found, whether it needs debugging info and what optimization level it should undergo.

So the answer I think you're looking for is that one would typically create a project, even if it's just for one file.  That's the norm for all IDEs I've used, anyway.

If an IDE you've used has a feature to "build and run whatever file is open", please let this forum know about it.  It could become a feature.

thomas

Building using the default options that you can set in your compiler preferences can be done with "Compile current file", and once it is built, the program can be run using "Run" too.

Debugging (and several other things) does not work without a project. No, this won't be added.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

danizobin

Thanks,

Anjuta can compile, run & (i think) debug single files.
Very convenient for scholar environments when programs are sporadic and short.

Dani

Seronis

Personally, i always have a project named 'quicktests' that use for throw-away 1 file programs.  Just select-all, delete, type new program (or copy/paste).

neuronet

I just use the terminal for such one-offs. I'm in linux, so:

g++ -o executable_name the_file.cpp
./executable_name


And voila! But, yeah, once you use code::blocks you have incurred an overhead and why fight the framework? I just make a folder for the simple little one-off scripts, and then in the same folder I will also start projects. It's easy to tell them apart.