passing command line arguments to target while debugging

I'm using Code::Blocks 8.02 for Windows. I can't work out how to pass command line arguments to the target application when debugging.

1) Project->set program's arguments->select target->debug.
2) Checkbox "this target provides the project's main executable" is checked.
3) Host application is given.

But it all doesn't work. When debugging the app, the arguments aren't passed to the target.
*************************
Maybe instead of explaining the mysteries of Code::Blocks someone could tell me how to pass command line arguments to the target application using the Insight debugger (also for Windows)?



For me it works with no problem, with and without host application or checking the main executable thing. ( On Ubuntu )

If you are using GDB to run a program with arguments is quite easy:
1
2
3
$ gdb # on Windows you may have to specify path and add .exe
(gdb) exec yourprogram arguments
(gdb) run
( bolded parts are what you actually have to type in the terminal )
Last edited on
Yes, thank you, now it works fine.

But another question emerges: I would like to pass the input data also per stream (cin, gets) to application, not only as argument. On my Linux machine I use the kgdb graphical front end to the gdb debugger. With this kgdb tool, I can specify under "program arguments" something like this:
"< filename", where filename is the file with input data. Then the program takes the data from that file. I tried the same with my Windows tools (Code::Blocks, Insight) - it did not work. Actually, this is what I meant with my topic from the beginning, I only described it in a wrong way.
< file is a shell operator. I don't know if it works on Windows' cmd. Did you try CygWin to get a bash shell on Windows?
I tried < filename in a DOS-Box of Windows. It worked fine. The application read the data from the file (per cin) as if it were the input stream. Only as configuration of debugger it fails.
Topic archived. No new replies allowed.