简体   繁体   English

Visual Studio C++ - 为每个构建解决方案配置更改 main.cpp 文件

[英]Visual Studio C++ - change main.cpp file for each build solution configuration

I need to change default(main.cpp) file for each build configuration.我需要为每个构建配置更改默认(main.cpp)文件。

Two cpp files两个cpp文件

  1. main.cpp - created on project creation time main.cpp - 在项目创建时创建
  2. second.cpp第二个.cpp

Two build configurations.两种构建配置。

  1. Release - compiling main.cpp发布 - 编译 main.cpp
  2. Custom - also compiling main.cpp but i need to compile second.cpp自定义 -也编译 main.cpp 但我需要编译second.cpp

How can i do this?我怎样才能做到这一点? Thank you very much.非常感谢。

Answer provided by Richard Critten:理查德克里滕提供的答案:

Right click the file > Properties > General > Exclude from build

This excludes the file from the build for the currently selected configuration at the top of the dialog.这将从对话框顶部当前所选配置的构建中排除该文件。 You can create as many custom configurations as you need.您可以根据需要创建任意数量的自定义配置。

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

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