VS C ++ 2010版本构建引用调试DLL [英] VS C++ 2010 release build referendcing debug DLLs

查看:101
本文介绍了VS C ++ 2010版本构建引用调试DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近有一个项目从.net 2002升级到了2010.长话短说,当我看看它与依赖行者的依赖时,我看到它引用了mfc100d.dll和msvr100d.dll(以及msvr100.dll).尽管我正在创建dll的发行版,但这些引用仍然存在.因此,直到我尝试将其分发给普通用户时,我才注意到该问题.一个autocad arx文件会引用它,并且arx加载尝试将失败,直到我将这两个调试文件都放到与arx和dll相同的文件夹中为止.

首先,我不是C ++专家,所以请为此做好准备.在发布配置的项目属性中,我已将链接器设置为不生成调试信息(没有区别).除此之外,我真的不知道如何使用mfc100.dll和msvr100.dll代替调试对象来获得该死的东西.

有任何想法吗?有什么建议吗?问题?谢谢!

2011/08/09
我会补充说,这个问题与我将其升级到VS 2010有关.2002版本可以正常编译,并且依赖项walker显示没有正在使用的调试dll.

i''ve got a project i upgraded from .net 2002 to 2010 recently. long story short, when i have a look at it''s dependencies with dependency walker, i see that it''s referencing mfc100d.dll and msvr100d.dll (as well as msvr100.dll). These references persist despite the fact that i''m creating a release build of the dll. so i didn''t notice the problem of course until i tried to distribute it to normal users. an autocad arx file references it, and the arx load attempt will fail miserably until i drop both of these debug files into the same folder as the arx and dll.

First off, I''m not a C++ guru, so be ready for that. in the project properties of the release config, i''ve set the linker to not generate debug info (made no difference). other than that, i''m really out of ideas for how to get this damn thing to use mfc100.dll and msvr100.dll instead of their debug counterparts.

Any ideas? suggestions? questions? thanks!

2011/08/09
i''ll add that this problem relates to my upgrading it to VS 2010. the 2002 version compiles fine and dependency walker shows no debug dlls in use.

推荐答案

ok ,感谢大家的建议.我突然意识到,为了升级该死的东西,我升级到2010年后确实必须添加一些预处理器定义(在帖子中阅读).这是我在项目属性中输入的内容> c/c ++预处理器预处理程序定义:

WIN32
_WINDOWS
_DEBUG
_USRDLL
WINVER = 0x0501
_WIN32_WINNT = 0x0501
_WIN32_WINDOWS = 0x0501
_WIN32_IE = 0x0500

在那里定义了_DEBUG,对不对?一定是,因为我删除了_DEBUG行,并且现在依赖项遍历器不显示任何调试dll的用法.这样问题就解决了.再次感谢您参与,大师们.

那时我没有看到我在将某人针对构建问题提出的所有解决方案粘贴到我自己的项目中并随其运行时犯了一个错误.任何人都对其余的定义有疑问吗?
ok, thanks everyone for your suggestions. it dawned on me that i did have to add some preprocessor definitions (read it in a post) after i upgraded to 2010 in order for the damn thing to compile. here''s what i put in project properties > c/c++ > preprocessor > preprocessor definitions:

WIN32
_WINDOWS
_DEBUG
_USRDLL
WINVER=0x0501
_WIN32_WINNT=0x0501
_WIN32_WINDOWS=0x0501
_WIN32_IE=0x0500

so _DEBUG is defined there, right? Must be, because i removed the _DEBUG line and now dependency walker doesn''t show any debug dll usage. So the problem is solved. thanks again for chipping in, gurus.

I didn''t see then that i was making a mistake pasting all of someone''s proposed solution to a build issue into my own project and just running with it. Anyone take issue with any of the rest of the defines?


我会先查看发布版本的定义,因为以下情况很常见:
I''d start by looking at the defines for the release build as the following is pretty usual:
#ifdef _DEBUG
#pragma comment(lib,"debug.lib")
#else
#pragma comment(lib,"release.lib")
#endif



在您的情况下,这很可能会解决您的问题,因为您会找到此



In your case this will probably fix your problem as you''ll find this

#ifndef _AFXDLL
	#ifndef _UNICODE
		#ifdef _DEBUG
			#pragma comment(lib, "nafxcwd.lib")
		#else
			#pragma comment(lib, "nafxcw.lib")
		#endif
	#else
		#ifdef _DEBUG
			#pragma comment(lib, "uafxcwd.lib")
		#else
			#pragma comment(lib, "uafxcw.lib")
		#endif
	#endif
#else
	#ifndef _UNICODE
		#ifdef _DEBUG
			#pragma comment(lib, "mfc" _MFC_FILENAME_VER "d.lib")
			#pragma comment(lib, "mfcs" _MFC_FILENAME_VER "d.lib")
		#else
			#pragma comment(lib, "mfc" _MFC_FILENAME_VER ".lib")
			#pragma comment(lib, "mfcs" _MFC_FILENAME_VER ".lib")
		#endif
	#else
		#ifdef _DEBUG
			#pragma comment(lib, "mfc" _MFC_FILENAME_VER "ud.lib")
			#pragma comment(lib, "mfcs" _MFC_FILENAME_VER "ud.lib")
		#else
			#pragma comment(lib, "mfc" _MFC_FILENAME_VER "u.lib")
			#pragma comment(lib, "mfcs" _MFC_FILENAME_VER "u.lib")
		#endif
	#endif
#endif

#ifdef _DLL
	#if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG)
		#pragma comment(lib, "msvcrtd.lib")
	#else
		#pragma comment(lib, "msvcrt.lib")
	#endif
#else
	#if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG)
		#pragma comment(lib, "libcmtd.lib")
	#else
		#pragma comment(lib, "libcmt.lib")
	#endif
#endif


在afx.h

最好的问候
Espen Harlinn


in afx.h

Best regards
Espen Harlinn


您可能还需要检查项目属性.

在配置属性->"下C/C ++->代码生成",请确保在执行发布版本时未将运行时库设置为使用调试版本.
You might also want to check the project properties.

Under ''Configuration Properties -> C/C++ -> Code Generation'' Make sure that your Runtime Library isn''t set to use the Debug versions when doing a Release build.


这篇关于VS C ++ 2010版本构建引用调试DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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