如何在带有 C++ 的 Visual Studio 2013 中创建可执行文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20820542/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I create an executable in Visual Studio 2013 w/ C++?
提问by Viridian Tourist
I can't find the exe file for my Hello World program that succeeded to work, and the program did not open as soon as it said it worked. I tried going to my documents and checking my project's folder. It was completely empty. Thanks for any and all help.
我找不到成功运行的 Hello World 程序的 exe 文件,并且该程序在它说可以运行时没有立即打开。我尝试查看我的文档并检查我的项目文件夹。它完全是空的。感谢您的任何帮助。
回答by Joe
All executable files from Visual Studio should be located in the debug folder of your project, e.g:
Visual Studio 中的所有可执行文件都应位于项目的调试文件夹中,例如:
Visual Studio Directory: c:\users\me\documents\visual studio
Visual Studio 目录:c:\users\me\documents\visual studio
Then the project which was called 'hello world' would be in the directory:
然后名为“hello world”的项目将在目录中:
c:\users\me\documents\visual studio\hello world
c:\users\me\documents\visual studio\hello world
And your exe would be located in:
您的 exe 将位于:
c:\users\me\documents\visual studio\hello world\Debug\hello world.exe
c:\users\me\documents\visual studio\hello world\Debug\hello world.exe
Note the exe being named the same as the project.
请注意 exe 与项目名称相同。
Otherwise, you could publish it to a specified folder of your choice which comes with an installation, which would be good if you wanted to distribute it quickly
否则,您可以将其发布到您选择的指定文件夹中,该文件夹随安装一起提供,如果您想快速分发它会很好
EDIT:
编辑:
Everytime you build your project in VS, the exe is updated with the new one according to the code (as long as it builds without errors). When you publish it, you can choose the location, aswell as other factors, and the setup exe will be in that location, aswell as some manifest files and other files about the project.
每次在 VS 中构建项目时,都会根据代码使用新的 exe 更新(只要构建没有错误)。发布时,可以选择位置,以及其他因素,安装exe将在该位置,以及一些清单文件和有关项目的其他文件。
回答by user1146300
- Click BUILD > Configuration Manager...
- Under Project contexts > Configuration, select "Release"
- BUILD > Build Solution or Rebuild Solution
- 单击构建 > 配置管理器...
- 在项目上下文 > 配置下,选择“发布”
- 构建 > 构建解决方案或重建解决方案
回答by Suvin
Just click on "Build" on the top menu and then click on "Publish ".... Then a pop up will open and there u can define the folder which u want to save the .exe file and by clicking "Next" will allow u to set up the advanced settings... DONE!
只需单击顶部菜单上的“构建”,然后单击“发布”.... 然后将打开一个弹出窗口,您可以在那里定义要保存 .exe 文件的文件夹,然后单击“下一步”允许您设置高级设置...完成!
回答by DanGoodrick
Do ctrl+F5 to compile and run your project without debugging. Look at the output pane (defaults to "Show output from Build"). If it compiled successfully, the path to the .exe file should be there after {projectname}.vcxproj ->
执行 ctrl+F5 编译和运行您的项目,无需调试。查看输出窗格(默认为“显示来自构建的输出”)。如果编译成功,.exe 文件的路径应该在 {projectname}.vcxproj -> 之后