移植 C++ 后链接器错误 应用程序从VC6到VS2005
我在将应用程序从 VC6 移植到 Visual Studio 2005 时遇到错误。
有人知道这意味着什么吗?
mfcs80.lib(dllmodul.obj):错误 LNK2005:_DllMain@12 已定义 在MSVCRT.lib(dllmain.obj)
I am getting an error while porting my application from VC6 to Visual Studio 2005.
Does anyone have any idea what this means?
mfcs80.lib(dllmodul.obj) : error
LNK2005: _DllMain@12 already defined
in MSVCRT.lib(dllmain.obj)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
来自 http://support.microsoft.com/default.aspx ?scid=kb;en-us;q148652
因为
所以
任何一个
或者
From http://support.microsoft.com/default.aspx?scid=kb;en-us;q148652
Because
So
Either
Or
我确信发生这种情况的原因有很多 - 我发现的最糟糕的一个是当尝试集成许多最初是 DLL 的静态库(我们的)时(事实上,我们将项目构建为 DLL 和 DLL)。静态库)。
我们的 C++/CLI DLL 使用这些库的静态版本(以避免在使用 C++/CLI Dll 时导致 ASP.NET 加载问题的 DLL 依赖问题),并且最初看到相同的链接器错误。
问题原来是使用了 AFX_MANAGE_STATE(AfxGetStaticModuleState()) 宏,当代码构建为 DLL 时需要该宏,但静态库调用实际上并不需要该宏。
为了解决这个问题,我最终将以下代码添加到每个项目的 stdafx.h 中。
当然,这可能不是您的具体问题。 但我最终想到的方法是打开链接器的 /VERBOSE 选项并查看谁、什么、在哪里以及在哪里。 当它拉入运行时库时。 (项目属性/配置属性/链接器/在vs2005中显示进度)
I'm sure there are a number of reason this could happen - the worst one I ever found was when trying to integrate a number of static libraries (ours) that were originally DLLS (in fact, we build the projects as both DLL & static libraries).
Our C++/CLI DLL was using the static versions of these libraries (To avoid DLL dependency issues that were causing ASP.NET loading issues when the C++/CLI Dll was being used) and was initially seeing the same linker error.
The problem turned out to be the use of AFX_MANAGE_STATE(AfxGetStaticModuleState()) macro that was needed when the code was built as a DLL but not actually needed for the static library call.
To solve this i ended up adding the following code to the stdafx.h of each project.
This, of course, may not be your specific problem. But the way i eventually figured it was by turning on the /VERBOSE option for the linker and seeing who, what, where & when it was pulling in the runtime libraries. (Project Properties/Configuration Properties/Linker/Show Progress in vs2005)
您可以设置链接器输入以忽略项目属性中的问题库,但这可能有效,也可能无效。
You could set the linker input to ignore the troubling library in the project properties, but this may or may not work.