Author Topic: Configure run/launch command in C::B  (Read 4456 times)

Offline Piece_o_Ham

  • Single posting newcomer
  • *
  • Posts: 5
Configure run/launch command in C::B
« on: March 04, 2014, 06:53:36 am »
I am trying to figure out how I can configure the "Run" button in C::B. I am setting up a compiler that outputs non-executable files, and C::B doesn't know how to handle them. These files need to be opened in another program, which is run from the command line. I have come up with one solution to this problem, but it has a few issues.

Here is how I initially solved the problem:

Create a new build target called "RunScript".
Set the compiler to "No Compiler".
Set the type to "Console application".
Uncheck "Auto-generate filename extension", and set the output filename to "RunButton.bat".
Create a new file called "RunButton.bat" (or whatever you entered as the output filename).
Whatever you put in "RunButton.bat" will now be executed when you click the run button.
I also created a new virtual target that contained my "RunScript" target, and my main target, so that I don't have to switch targets whenever I want to test my application.

While this method does work, it is not ideal, as it requires you to have two extra targets (including the virtual target that I made for convenience). I would rather be able to just have everything contained in one target.

One solution to this problem that I came up with, is to replace the console runner program that is used by code blocks. But this doesn't seem like the best solution. I honestly think that being able to configure launch scripts should be a built-in feature. Does anybody know how I can solve this problem? It has been giving me problems for days already.

Thanks.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Configure run/launch command in C::B
« Reply #1 on: March 04, 2014, 07:07:40 am »
Way easier would have been the use of the tools/tools+ plugin with the use of macros. :)
There is also a "commands only" target... depending on your needs.
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 Piece_o_Ham

  • Single posting newcomer
  • *
  • Posts: 5
Re: Configure run/launch command in C::B
« Reply #2 on: March 04, 2014, 07:18:13 am »
Way easier would have been the use of the tools/tools+ plugin with the use of macros. :)
There is also a "commands only" target... depending on your needs.

Thanks for your reply.

I am aware of the tools plugin. However, that would require me to go to another menu (I just realized how lazy that sounds :P). I may use that instead, as that would eliminate the extra targets.

One more thing: Could you explain what the "Commands only" option is for? I tried setting that as the type, but I couldn't figure it out. Again, I think that compilers should be able to control how programs are launched, as that would make code blocks about a million times more flexible.

Offline Dvorkin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Configure run/launch command in C::B
« Reply #3 on: March 04, 2014, 10:46:13 am »
You can assign a hotkey to your macros in the Tools menu. So you don't need "to go to another menu" :)

I've used PSCP.EXE and PUTTY.EXE to copy output file to remote system and to start GDB server on remote system.
I've written BAT files (to automate work) and I've created macros in Tool menu. So I have 2 items - "copy" and "start GDB server" in Tool menu, each item has it's own hotkey.