Visual Studio 2017 not passing command line arguments to the application. RRS feed

  • Question

  • I set command line arguments for my c++ application to what I needed and hit F5. Lo and behold, argc = 1 and my parameters are not in argv either. I set them through the Properties window of my project. 

    I eventualy solved it by randomly switching between x86 and x64. The arguments were set for x86 and the program was compiled to x86 at the same time. But switching to x64 solved it for some reason. 

    Is this a bug? Or did I do something wrong? I am new to c++... 
    Thursday, November 16, 2017 2:23 PM

All replies

  • I assume you set arguments on project property page -> debugging:

    If there are several projects in your solution, please open  configuration manager:

    and make sure it targets Active solution platform to Any CPU:

    Then check the C++ application and make sure it's set up to the same as Active solution platform   

    which has two options:  X64 or Win32, but if the Active solution platform is set to Any CPU then it's supposed to work for either of them.

    Btw, I'm using VS2017 15.4


    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    • Edited by Fletch Zhou Friday, November 17, 2017 7:20 AM
    • Proposed as answer by Fletch Zhou Monday, November 20, 2017 8:22 AM
    Friday, November 17, 2017 7:20 AM
  • Also ensure your 'Active solution configuration' is consistent.

    If you're looking for an error in your Release version, you'll never find it if you're only building the Debug version.

    Tuesday, July 2, 2019 4:35 PM