Debugging with command-line parameters in Visual Studio

前端 未结 9 1826
误落风尘
误落风尘 2020-11-22 14:52

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

9条回答
  •  太阳男子
    2020-11-22 15:42

    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.

提交回复
热议问题