调试模式下的访问冲突错误. [英] access violation error in debug mode.

查看:83
本文介绍了调试模式下的访问冲突错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究VS2008 MFC上的应用程序,其中引用了第三方lib文件,该文件在我的应用程序的发行版中可以正常工作.

我以这种方式在应用程序中调用的方法签名...

CXerror :: Init(路径,文件名,路径);

该方法在lib文件中.当我在应用程序的发布"模式下构建时,它可以正常工作.但是,当在调试模式下调用相同的代码时,出现错误消息



在My.exe中0x003a60e3处的首次机会异常:0xC0000005:访问冲突读取位置0x003a607e."

和My.exe退出.

您可以在此共享一些信息吗?

I am on working on application on VS2008 MFC, where I am refering a third party lib file, which works fine on release build of my application.

the method signature which I called in my application in this way...

CXerror::Init(path,filename,path);

This method is their in the lib file. which works fine when I build in Release mode of my application. But when same code is called in debug mode I am getting error saying



"First-chance exception at 0x003a60e3 in My.exe: 0xC0000005: Access violation reading location 0x003a607e."

and My.exe exits.

can you share some info on this ...

推荐答案

如果您的应用程序使用库,请确保您链接到相同的C运行时库(CRT)(例如它使用多线程DLL,因此您也需要将同一CRT与您的应用程序链接).否则,将出现访问冲突错误.

由于第三方DLL必须是发行版本的DLL,因此它必须已链接到CRT的发行版本.在调试版本中,您的应用将链接到CRT的调试版本.要求DLL的供应商也向您提供其库的调试版本.在调试版本中,您可以将其链接到其DLL的调试版本.
If your app uses libraries, make sure that you link to the same C runtime library (CRT)(e.g. if it uses Multithreaded DLL you too need to link the same CRT with your app). Otherwise, you will get access violation errors.

Since the 3rd party DLL must be a release build DLL, it must have been linked to release version of CRT. While, in debug build, your app will link to debug version of CRT. Ask the supplier of the DLL to provide you with a debug version of their library also. In debug build, you can link it to the debug version of their DLL.


这篇关于调试模式下的访问冲突错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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