User forums > Using Code::Blocks

Compiling outside of project

(1/1)

bugmenot:
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.

thomas:
"Compile Current File" in the "Build" menu.

bugmenot:
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?

MortenMacFly:

--- Quote from: 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?

--- End quote ---
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.

bugmenot:
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.

Navigation

[0] Message Index

Go to full version