简体   繁体   English

如何在C ++中使用条件更改项目名称

[英]How change project name with conditions in c++

How can i change change the name of project executable in c++? 如何更改C ++中项目可执行文件的名称?

I know that i can do it in Project Properties under "Configuration Properties", but i want to do it in my code, for example using conditions 我知道我可以在“配置属性”下的“项目属性”中执行此操作,但是我想在我的代码中执行此操作,例如使用条件

#ifdef *something define*
        //Project name be A.exe
#else
        //Project name be B.exe
#endif

I'm afraid, it is not possible to change the executable name from code. 恐怕无法从代码更改可执行文件名称。 The nearest thing possible is to define two build configurations (like Release-A and Release-B) with different executable names in the properties and different defines. 最可能的事情是定义两个构建配置(例如Release-A和Release-B),并在属性中定义不同的可执行文件名称。 So you can change the executable name and some defines at the same time by chosing the configuration. 因此,您可以通过选择配置来同时更改可执行文件名称和一些定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM