I\'m developing a C++ command-line application in Visual Studio and need to debug it with command-line arguments. At the moment I just run the generated EXE file with the ar
Right click on the project in the Solution window of Visual Studio, select "Debugging" (on the left side), and enter the arguments into the field "Command Arguments":
Even if you do start the executable outside Visual Studio, you can still use the "Attach" command to connect Visual Studio to your already-running executable. This can be useful e.g. when your application is run as a plug-in within another application.
This may help some people who still have problems.
I use Visual Studio 2015 and I could only pass the arguments when I changed the definition of argv
.
Instead of
int main(int argc, char **argv){
}
I had to use
int main(int argc, char *argv[]){
}
I do not know why it was necessary, but it works.