猿问

vs2013 assert失败时总是突然结束,不给出任何提示信息,怎么办?

我在c++程序中使用assert,每次如果assert中的内容测试失败,程序就直接结束了,什么提示都不给出,常常给人莫名其妙的感觉,为什么就突然结束了?有时会立即想到是不是assert不通过,但查找是哪个assert不通过也常常很花费功夫!有时要找很久才想起是不是哪个assert又不通过,真汗!我使用vs2013,这个assert不应该是这样的吧?是不是有一个地方可以设置它不要突然结束程序,而是给出提示?百度很久没有答案,望高手指教!


慕尼黑8549860
浏览 978回答 2
2回答

当年话下

试试stackoverflow上提到的方法(Visual Studio exits on assertion failure with no error message):In my case, the problem was that Configuration Properties -> C/C++ -> Code Generation -> Runtime Library was set to "Multi-threaded" for both the Debug and Release builds. The correct setting is "Multi-threaded Debug" for the Debug build and "Multi-threaded" for the Release Build.
随时随地看视频慕课网APP
我要回答