News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Compiling outside of project

Started by bugmenot, January 25, 2008, 07:40:13 AM

Previous topic - Next topic

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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

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?
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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

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.