简体   繁体   English

visual studio 2010单个项目,带有多个主要的cpp文件

[英]visual studio 2010 single project with multiple cpp files with main

I want to examine a lot of little cpp files that have int main() , and run only one of them at one running . 我想检查很多具有int main()的小cpp文件,并且在一次运行时只运行其中一个。 something like this - 像这样的东西 -

在此输入图像描述

Is there any way to do that without open new project for every cpp file ? 如果没有为每个cpp文件打开新项目,有没有办法做到这一点?

No. In a project, you cannot have multiple main() function. 在项目中,您不能有多个main()函数。

You can rename them to test1() , test2() , test3() , and call them one by one from main() . 您可以将它们重命名为test1()test2()test3() ,并从main()逐个调用它们。 That is what I do usually. 这就是我通常做的事情。

You can choose not to compile the files. 您可以选择不编译文件。 Go to the properties, and exclude the file from build. 转到属性,并从构建中排除该文件。

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

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