Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: bugmenot on January 25, 2008, 07:40:13 am

Title: Compiling outside of project
Post by: bugmenot on January 25, 2008, 07:40:13 am
Is there any way to compile source outside of your project?

eg. I open a project with one file, main.cpp. I then open another file called test.cpp that is seperate from the project.

Now if I click on the test.cpp tab and go build, it just builds the project file (main.cpp) instead of test.cpp.

Any help would be appreciated.
Title: Re: Compiling outside of project
Post by: thomas on January 25, 2008, 09:11:07 am
"Compile Current File" in the "Build" menu.
Title: Re: Compiling outside of project
Post by: bugmenot on January 25, 2008, 10:09:25 am
I have just done that, and it compiles, but is there a way/option to get it to run in Code::Blocks once it has compiled?
Title: Re: Compiling outside of project
Post by: MortenMacFly on January 25, 2008, 10:51:48 am
I have just done that, and it compiles, but is there a way/option to get it to run in Code::Blocks once it has compiled?
You can use the tool menu for that. A macro points to the current editor file name -> adjust the extension (e.g. ".exe") and you can run any compiled file through the tool menu.
Title: Re: Compiling outside of project
Post by: bugmenot on January 25, 2008, 08:26:48 pm
Ok, I seem to have a few problems with trying to do that.

1. I used the ${ACTIVE_EDITOR_FILENAME} macro but if I add .exe to the end of this it ends up as .cpp.exe. Any way to fix this?

2. And is there a way for the tool to find the directory the .cpp file is in? Because when I execute the tool it searches the project directory unless I specify a directory.