Command line arguments ignored

  • Thread starter Thread starter Roland
  • Start date Start date
R

Roland

Hi,

I am developing a C++ project and want to pass some command line
arguments in VS .NET 2003. I am in debug mode, the configuration is set
to Debug and I entered my argument list in Project -> Project
Properties -> Configuration Properties -> Debugging -> Command
Arguments. The blurb provided in the properties window for this field
reads "The command line arguments to pass to the application." which
sounded promising.

However, when I hit F5 or click on Debug -> Start and in my program
check for the number of arguments, my argument list is ignored, i.e. no
arguments are passed on. Not quite the expected behaviour.

If I start my program from a command line outside VS, the arguments are
passed on correctly, so I don't think it is my program but rather that
I misunderstand the settings in the properties window. Does anyone have
an idea of what I am missing?

Regards,
Roland
 
Roland skrev:
Hi,

I am developing a C++ project and want to pass some command line
arguments in VS .NET 2003. I am in debug mode, the configuration is set
to Debug and I entered my argument list in Project -> Project
Properties -> Configuration Properties -> Debugging -> Command
Arguments. The blurb provided in the properties window for this field
reads "The command line arguments to pass to the application." which
sounded promising.

However, when I hit F5 or click on Debug -> Start and in my program
check for the number of arguments, my argument list is ignored, i.e. no
arguments are passed on. Not quite the expected behaviour.

If I start my program from a command line outside VS, the arguments are
passed on correctly, so I don't think it is my program but rather that
I misunderstand the settings in the properties window. Does anyone have
an idea of what I am missing?

Regards,
Roland

Hi Roland

I am using the same way of specifying parameters to my program and it
works fine both in debugging and in real life.

Does your parameters have a special format or special characters?

Svend-Erik
 
Hi Svend-Erik,

no, the parameters have no special format. I even simply tried integer
numbers like 123, but end up having the same problem.

What do you have in the 'Command' field? In my settings, VS puts
$(TargetPath) there. Not sure if that is what should be there.

Roland
 
Roland

I have the same value in my 'command' field.

But notice that if you have more projects in your solution, (for
example dll libraries), then the command line parameters must be set in
the executing project (the exe file project)

Svend-Erik
 
Hi Svend-Erik,

thanks! That was the problem. Somehow it had set to startup a different
part of the project. I had to set it to 'Single Startup Project' and
then select the right one and it worked.

Roland
 
Back
Top