Author Topic: Compiling outside of project  (Read 4048 times)

Offline bugmenot

  • Multiple posting newcomer
  • *
  • Posts: 32
Compiling outside of project
« 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.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Compiling outside of project
« Reply #1 on: January 25, 2008, 09:11:07 am »
"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."

Offline bugmenot

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: Compiling outside of project
« Reply #2 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?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Compiling outside of project
« Reply #3 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline bugmenot

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: Compiling outside of project
« Reply #4 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.