你在 C++ 下得到调试断言吗?当没有安装CRT时?
当您在未安装 VS 或 CRT 的操作系统上运行调试版本的 C++ 程序时,您是否还会收到“调试断言”错误框?
那些说“调试断言失败!”的。
或者只有当计算机安装了某些组件(例如 CRT 或 Visual Studio)时才能获得它们?
When you have a Debug version of a C++ program running on an OS that has no VS or CRT installed, will you still get Debug Assertion error boxes?
The ones that say "Debug Assert Failed!".
Or will you only get them when the machine has certain components, such as CRT or Visual Studio installed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于您如何构建应用程序。如果您动态链接到调试 CRT,那么用户不太可能在其系统上拥有调试 CRT,除非他们是开发人员(事实上,由于 VS 的许可,您无法分发它)。所以在这种情况下它甚至不会运行。如果您静态链接到 CRT,那么如果您向用户提供了调试版本,则用户将看到断言。
It depends how you've built your application. If you're dynamically linking to the debug CRT then it's very unlikely the user will have the debug CRTs on their system unless they're developers (and in fact you can't distribute it due to the licensing of VS). So in this case it won't even run. If you statically link to the CRT then the user will see the asserts if you've shipped them a debug build.
如果你能让它运行,是的。使用 /MDd(默认)进行编译需要分发动态 CRT 的调试版本。它不是可重新分发的组件,无论如何发布它都是违反许可证的行为。您可以通过使用 /MTd 进行编译来绕过它。
当然,您的用户将不知道“调试断言失败”意味着什么,并且不会理解为什么忽略不起作用。最好避免。
If you can get it to run, yes. Compiling with /MDd (the default) requires distributing the debug version of the dynamic CRT. It is not a redistributable component, shipping it anyway is a license violation. You could get around it by compiling with /MTd.
Of course, your user will have no idea what "Debug assertion failed" means and won't understand why Ignore doesn't work. Best avoided.