错误仅在调试时出现,而不是在更改为发布模式时出现 [英] Error comes only when debugging and not when changed to Release mode

查看:61
本文介绍了错误仅在调试时出现,而不是在更改为发布模式时出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目在释放模式下可以成功运行,但是在调试模式下却出现致命错误,如何在调试模式下清除此错误.

我应该在链接器中以调试模式包含库文件吗?如果是,我可以包含哪些实际的库文件来解决此问题.

该项目是使用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.


这篇关于错误仅在调试时出现,而不是在更改为发布模式时出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆