Author Topic: How do I set the arguments to run a target with?  (Read 5760 times)

Offline Jonathan Blow

  • Single posting newcomer
  • *
  • Posts: 3
How do I set the arguments to run a target with?
« on: June 30, 2008, 06:59:25 pm »
This is probably a stupid question but I can't figure out how to set command-line arguments when running a target from CodeBlocks.  This is one of the most basic things anyone would ever want to do, so there's got to be a way to do it, but I can't find it anywhere in the IDE, and I have searched the documentation and found nothing.

I found the place where the working directory gets set (in Properties/Build Targets/[target]/Execution working dir), which might be one place I would expect the arguments to be settable; it's not there.

Can anyone clue me in?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: How do I set the arguments to run a target with?
« Reply #1 on: June 30, 2008, 08:06:39 pm »
how to set command-line arguments when running a target from CodeBlocks.
Go to the menu "project" and then "Set program's arguments".
...probably we should rename this entry into something like "Set target's/program's arguments".
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 dje

  • Lives here!
  • ****
  • Posts: 683
Re: How do I set the arguments to run a target with?
« Reply #2 on: June 30, 2008, 09:11:33 pm »
What about Run/Debug arguments ?

Offline Jonathan Blow

  • Single posting newcomer
  • *
  • Posts: 3
Re: How do I set the arguments to run a target with?
« Reply #3 on: June 30, 2008, 11:20:52 pm »
Cool; thanks.  One of the first things I will try to write for Code::Blocks is a plugin that creates a toolbar that just has the arguments in it, so you can change them easily without navigating menus.  This was one of the things that annoyed me all to hell about Visual Studio (especially given how long it would take to pop up the settings menu)... CB's menus are a lot faster but it's still a lot more indirect than I would like!

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: How do I set the arguments to run a target with?
« Reply #4 on: July 01, 2008, 08:43:09 am »
What about Run/Debug arguments ?
...same thing?! I guess I don't get the question...?!
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 dje

  • Lives here!
  • ****
  • Posts: 683
Re: How do I set the arguments to run a target with?
« Reply #5 on: July 01, 2008, 09:10:30 am »
What about Run/Debug arguments ?
...same thing?! I guess I don't get the question...?!
The first time I use Code::Blocks, I was looking for something like Run/Debug arguments". I tried "Set program's arguments" once but I find it less clear than "Run/Debug arguments".

Dje

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: How do I set the arguments to run a target with?
« Reply #6 on: July 01, 2008, 02:39:20 pm »
but I find it less clear than "Run/Debug arguments".
You come from the VS world, right?! ;-)
This does not apply to C::B as targets do not necessarily be just "Release" and "Debug". Look at the C::B project file for example. There you don't have any release/debug target but just libraries, the SDK and the main application (and some preprocessor tools probably). So setting parameters for release/debug doesn't make sense for C::B.
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 dje

  • Lives here!
  • ****
  • Posts: 683
Re: How do I set the arguments to run a target with?
« Reply #7 on: July 01, 2008, 02:57:20 pm »
but I find it less clear than "Run/Debug arguments".
You come from the VS world, right?! ;-)
Yes, all is not wonderful but as there is only one framework and one compiler/linker/debugger completely imbricated/integrated/"englued", it seems that configuration is a little easier.

Nevertheless, forgetting Visual aspects, does it make sense to have this item in the project menu ?
Isn't host application useful only when working on static or shared libraries ? What should be related only to project/target ?
I think a better place for this could be in the project properties where we have the output/targets. I think we should find in the project menu the files related operations and the links to the project properties and build options, not this detailed part of configuration.

Dje

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: How do I set the arguments to run a target with?
« Reply #8 on: July 01, 2008, 03:30:20 pm »
dje: I think it's where it is because it is easier to access for people who regularly change their program args. I also had to ask before I found that option, but I'm not sure it's the name (although I see nothing wrong with "Run/Debug arguments" and I don't use VStudio) of the menu option as much as being in an unexpected place. The first thing I would do would be to move the menu item down between build options and properties in the project menu. An option to access that dialog could also be added as a button in project -> properties -> build targets.