Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: michaelp on February 23, 2008, 07:23:57 pm

Title: compiling multiple .cpp files without a project
Post by: michaelp on February 23, 2008, 07:23:57 pm
First of all, hi Code::Blocks community.  :D My first post, needing to ask a question.
Been using Code::Blocks for about 3 months now, it's great. Was using Dev-Cpp before, then switched. Anyways, to my question.

A lot of the time in Code::Blocks, I have wanted to compile more than 1 .cpp file without having to make another project. Let's say I have main.cpp, and questions.cpp. How do I get those 2 files to compile together without having to create a Code::Blocks project?
Title: Re: compiling multiple .cpp files without a project
Post by: thomas on February 23, 2008, 08:18:47 pm
You cannot do that. The IDE allows you to quickly compile one file into one program for your convenience, but for anything "serious", i.e. anything that takes several files, you need a project.

Well, actually you can get it to work if you are willing to write your own commandline and install that as "tool"... but I don't assume that is what you want.
Title: Re: compiling multiple .cpp files without a project
Post by: mariocup on February 23, 2008, 10:44:21 pm
Hi michaelp,

there is also another possibility. The plugin ShellExentsion Plugin (http://developer.berlios.de/projects/cbilplugin/) is a a file explorer within codeblocks. You can use so called shell extensions, that are put in the context menu. In your case you could define a shell extension e.g.

gcc $mpaths -o test.o

So if you select different files in the file explorer and choose the new context menu then $mpaths will be expanded with your selection.

See section "File Explorer and Shell Extension Plugin" in the online manual http://www.codeblocks.org/en-docs-wrapper for details.

Bye,

Mario

Title: Re: compiling multiple .cpp files without a project
Post by: michaelp on February 24, 2008, 01:50:26 am
@ mariocup: Seems like a lot of work. Not sure I'd want to do that. Thanks for the suggestion though.

@Thomas: Okay, just wanted to know if you could. Would be a nice feature if you could get that into Code::Blocks.  :D