错误仅在调试时出现,而不是在更改为发布模式时出现

编程入门 行业动态 更新时间:2024-10-26 14:38:14
本文介绍了错误仅在调试时出现,而不是在更改为发布模式时出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个项目在释放模式下可以成功运行,但是在调试模式下却出现致命错误,如何在调试模式下清除此错误. 我应该在链接器中以调试模式包含库文件吗?如果是,我可以包含哪些实际的库文件来解决此问题. 该项目是使用7.1 vc ++ mfc创建的,我在vc ++ 9.1中的调试模式下运行会导致问题吗?

I have a project which works successfully when its in release mode but it gives a fatal error in debug mode how to clear this error in debug mode. Should I include library files in debug mode in the linker? If yes what are the actual library files I can include to solve this problem. The project is created using 7.1 vc++ mfc i am running in debug mode in vc++9.1 is it causing problem?

推荐答案

根据收到的错误判断,关于预编译标头的使用,调试和发布模式的项目设置必须有所不同. 请注意,决定是否使用预编译头会影响整个项目以及项目中的每个cpp文件!如果您设置了使用选项,则所有cpp文件必须都将关联的头文件(通常为stdafx.h)作为该文件中的第一行(注释或空行).如果不是这种情况,则会收到您提到的错误消息.当然,如果头文件不存在或找不到,仅包含语句本身是不够的:确保它存在于项目中,并且位于项目的一部分,并确保其所在目录可访问通过您的包含路径. 请注意,即使您不使用预编译的标头,通常也需要包括相关的文件,因为它声明了您可以引用的类型或包含了其他标头.因此,注释掉include语句几乎总是一个错误! 如果不确定所需的设置,请与发布版本中使用的设置进行比较,或在此处询问. Judging by the error(s) you got, your project settings have to be different for Debug and Release mode regarding the use of precompiled headers. Note that the decision to use or not use precompiled headers affects the entire project, and every cpp file in your project! If you set the options to use them, all cpp files must include the associated header file (usually stdafx.h) as the very first line in that file (except comments or empty lines). If that is not the case, you get the error message that you mentioned. Of course, the include statement by itself is not sufficient, if the header file does not exist, or cannot be found: make sure it''s there and part of your project, and that the directory it''s stored in is accessible through your include path. Note that even if you don''t use precompiled headers, you normally still need to include the associated files as it declares types that you may reference or includes other headers that do. So, commenting out the include statement is almost always an error! If you''re unsure about the required settings, compare with the settings you used for the Release version, or ask here.

更多推荐

错误仅在调试时出现,而不是在更改为发布模式时出现

本文发布于:2023-11-26 22:05:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1635387.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:是在   而不   错误   模式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!