Visual Studio 2017不将命令行参数传递给应用程序。 [英] Visual Studio 2017 not passing command line arguments to the application.

查看:328
本文介绍了Visual Studio 2017不将命令行参数传递给应用程序。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的c ++应用程序的命令行参数设置为我需要的并点击F5。瞧,argc = 1,我的参数也不在argv中。我通过项目的"属性"窗口设置它们。 
$


我最终通过在x86和x64之间随机切换来解决它。参数设置为x86,程序同时编译为x86。但是由于某些原因,切换到x64解决了它。 
$


这是一个错误吗?或者我做错了什么?我是c ++的新手...... 

解决方案

我假设您在项目属性页面上设置参数 - >调试




如果您的解决方案中有多个项目,请打开  配置管理器


并确保 它将有源解决方案平台定位到任何CPU:




然后检查C ++应用程序并确保将其设置为  活动解决方案平台   



其中有两个选项:  X64或Win32 ,但如果
Active解决方案平台
设置为任何CPU,那么它应该为其中任何一个工作 。


顺便说一下,我正在使用VS2017 15.4


 


祝你好运,


Fletcher





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++... 

解决方案

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,

Fletcher


这篇关于Visual Studio 2017不将命令行参数传递给应用程序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆