Darrell
Darrell

Reputation: 33

VC++ command line arguments are being ignored

I am attempting to get someone else's VC++ project to work in VC8. The solution contains both a library and an executable. Each project is located in its own directory one level below the solution. When the code is compiled, the executable is placed in a debug folder under the solution folder rather than in the programdir\debug folder.

Here is the layout:

solutiondir\solution.sln
solutiondir\libdir\library.proj (and .cpp and .h files)
solutiondir\programdir\program.proj (and main.cpp)
solutiondir\debug\library.lib
solutiondir\debug\program.exe

Everything builds fine, but when I try to run program.exe, there is a problem that I am trying to debug. When I first started trying to run program.exe in debug mode, it asked me where the exe was located, so I browsed to the debug directory (solutiondir\debug), then the debugger was able to run program.exe. So far, so good.

The problem is that I can't get past the "usage" function because the command line arguments are not being picked up. I edited the properties of the program and there are definitely arguments in there, but argc == 1 and the only argument is the program name, a clear indication that the "Command Arguments" are being ignored or not found.

I am wondering if the problem has something to do with the directory structure or whether there is some variable like $(target) that needs to be set, though I tried setting that already. Am I missing something? Any help is appreciated.

Upvotes: 1

Views: 903

Answers (1)

1201ProgramAlarm
1201ProgramAlarm

Reputation: 32732

Set the project that builds the program executable as the default project, and that will be what runs when you start debugging.

Upvotes: 1

Related Questions