C++ Visual Studio F5、ctrl+F5 或在 Visual Studio 之外运行有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11202088/
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
What is different between visual studio F5, ctrl+F5, or running outside of visual studio?
提问by herzl shemuelian
I have written a program in vc++ that has different behavior in various case as below.
我在 vc++ 中编写了一个程序,它在各种情况下具有不同的行为,如下所示。
When I run it by F5 it works properly in release mode.
当我按 F5 运行它时,它在发布模式下正常工作。
When I run it by ctrl + F5 it crashes when I start to send data to the program.
当我按 ctrl + F5 运行它时,它会在我开始向程序发送数据时崩溃。
Outside of visual studio it crashes immediately.
在视觉工作室之外,它立即崩溃。
I don't know how to find the bug. Any idea on what is different between these cases?
不知道怎么找bug 知道这些情况有什么不同吗?
回答by Markus
Running ctrl + F5 will run the application without debugger. (http://msdn.microsoft.com/en-US/library/8b59xk0f(v=vs.90).aspx) This is not the same as running in release mode.
运行 ctrl + F5 将在没有调试器的情况下运行应用程序。( http://msdn.microsoft.com/en-US/library/8b59xk0f(v=vs.90).aspx) 这与在发布模式下运行不同。
You can run your application in debug mode but without debugger. It sounds stupid but is for example helpful if you want to stop the console from closing on exit. (How to stop console from closing on exit?)
您可以在调试模式下运行您的应用程序,但无需调试器。这听起来很愚蠢,但例如,如果您想阻止控制台在退出时关闭,则很有帮助。(如何阻止控制台在退出时关闭?)
回答by Jeeva
You need to understand the difference between running an application in debug mode and release mode. F5 will generally help you to debug the application and ctrl + F5 will execute the application. There might be some issues in release mode that makes your vs to crash. Read thisto get an understanding.
您需要了解在调试模式和发布模式下运行应用程序之间的区别。F5 一般会帮你调试应用程序,ctrl + F5 会执行应用程序。发布模式中可能存在一些问题,使您的 vs 崩溃。阅读本文以获得理解。