error LNK2005: _DllMain@12 已经在 MSVCRTD.lib(dllmain.obj) 中定义
2013-11-05 16:57
519 查看
链接报错:
错误 33 error LNK2005: _DllMain@12 已经在 MSVCRTD.lib(dllmain.obj) 中定义
E:\客户问题\w_王鹏\EventLibTest_TibrvAlternative_MultiEnv-4-0.3将DTSSysEvent.xml做为单独参数传给每个环境\EventLibTest_TibrvAlternative_MultiEnv\Win32\APPFL\EventLibMultiEnvDLL\mfcs100d.lib(dllmodul.obj)
EventLibMultiEnvDLL (Visual Studio 2010)
解决方法:
项目-》属性-》配置属性-》C/C++/预处理器,去掉预处理器定义中的_USRDLL 即可
另外:
常见预处理器设置的意义: http://blog.csdn.net/honker110/article/details/6120810
常见的编译参数VC建立项目时总会定义"Win32"。控制台程序会定义"_CONSOLE",否则会定义"_WINDOWS"。Debug版定义"_DEBUG",Release版定义"NDEBUG"
与MFC DLL有关的编译常数包括:
_WINDLL 表示要做一个用到MFC的DLL
_USRDLL 表示做一个用户DLL(相对MFC扩展DLL而言)
_AFXDLL 表示使用MFC动态链接库的 regular DLL
_AFXEXT 表示要做一个MFC扩展DLL
所以:
Regular, statically linked to MFC _WINDLL,_USRDLL
Regular, using the shared MFC DLL _WINDLL,_USRDLL,_AFXDLL
Extension DLL _WINDLL,_AFXDLL,_AFXEXT
Building Your DLL
When compiling regular DLLs that statically link to MFC, the symbols "_USRDLL" and "_WINDLL" must be defined. Your DLL code must also be compiled with the following compiler switches:
•/D_WINDLL signifies the compilation is for a DLL
•/D_USRDLL specifies you are building a regular DLL
When compiling regularDLLs that statically link to MFC, the symbols "_USR DLL" and"_WINDLL" must be defined. Your DLL code must also be compile dwith the following compiler switches:
When compiling regular DLLs that dynamicallylink to MFC, you must define t he above symbols and use the above compilerswitches. Additionally, the sy mbol "_AFXDLL" must be definedand your DLL code must be compiled with:
•/D_AFXDLL specifies that you are building a regular DLL that dynamicall y links to MFC
The interfaces (APIs) between the application and the DLL must beexplicitlyexported. It is recommended that you define your interfaces to be lowbandw idth, sticking to C interfaces where possible. More direct C interfaces areeasi er to maintain than more
complex C++ classes.
Place your APIs in aseparate header that can be included by both C and C++files (that way you won'tlimit your DLL customers to C++ programmers). Se e the header ScreenCap.h in theMFC Advanced Concepts sample DLLScreen Cap for an example. To export yourfunctions,
enter them in theEXPORTSs ection of your moduledefinition file (.DEF) or include__declspec(dllexpor t)on yourfunction definitions. Use__declspec(dllimport)to import thesefunctions into the client executable.
You must add theAFX_MANAGE_STATEmacro at the beginning of all the e xportedfunctions in regular DLLs that dynamically link to MFC to set the curr ent modulestate to the one for the DLL. This is done by adding the followingline of codeto the beginning of
functions exported from the DLL:
AFX_MANAGE_STATE(AfxGetStaticModuleState( ))
WinMain->DllMain
The MFC library defines the standard Win32DllMain entry point that initializ es yourCWinAppderived object as in a normal MFC application. Placeall DLL-specific initialization in theInitInstancememberfunction as in a normal MFC application.
错误 33 error LNK2005: _DllMain@12 已经在 MSVCRTD.lib(dllmain.obj) 中定义
E:\客户问题\w_王鹏\EventLibTest_TibrvAlternative_MultiEnv-4-0.3将DTSSysEvent.xml做为单独参数传给每个环境\EventLibTest_TibrvAlternative_MultiEnv\Win32\APPFL\EventLibMultiEnvDLL\mfcs100d.lib(dllmodul.obj)
EventLibMultiEnvDLL (Visual Studio 2010)
解决方法:
项目-》属性-》配置属性-》C/C++/预处理器,去掉预处理器定义中的_USRDLL 即可
另外:
常见预处理器设置的意义: http://blog.csdn.net/honker110/article/details/6120810
常见的编译参数VC建立项目时总会定义"Win32"。控制台程序会定义"_CONSOLE",否则会定义"_WINDOWS"。Debug版定义"_DEBUG",Release版定义"NDEBUG"
与MFC DLL有关的编译常数包括:
_WINDLL 表示要做一个用到MFC的DLL
_USRDLL 表示做一个用户DLL(相对MFC扩展DLL而言)
_AFXDLL 表示使用MFC动态链接库的 regular DLL
_AFXEXT 表示要做一个MFC扩展DLL
所以:
Regular, statically linked to MFC _WINDLL,_USRDLL
Regular, using the shared MFC DLL _WINDLL,_USRDLL,_AFXDLL
Extension DLL _WINDLL,_AFXDLL,_AFXEXT
Building Your DLL
When compiling regular DLLs that statically link to MFC, the symbols "_USRDLL" and "_WINDLL" must be defined. Your DLL code must also be compiled with the following compiler switches:
•/D_WINDLL signifies the compilation is for a DLL
•/D_USRDLL specifies you are building a regular DLL
When compiling regularDLLs that statically link to MFC, the symbols "_USR DLL" and"_WINDLL" must be defined. Your DLL code must also be compile dwith the following compiler switches:
When compiling regular DLLs that dynamicallylink to MFC, you must define t he above symbols and use the above compilerswitches. Additionally, the sy mbol "_AFXDLL" must be definedand your DLL code must be compiled with:
•/D_AFXDLL specifies that you are building a regular DLL that dynamicall y links to MFC
The interfaces (APIs) between the application and the DLL must beexplicitlyexported. It is recommended that you define your interfaces to be lowbandw idth, sticking to C interfaces where possible. More direct C interfaces areeasi er to maintain than more
complex C++ classes.
Place your APIs in aseparate header that can be included by both C and C++files (that way you won'tlimit your DLL customers to C++ programmers). Se e the header ScreenCap.h in theMFC Advanced Concepts sample DLLScreen Cap for an example. To export yourfunctions,
enter them in theEXPORTSs ection of your moduledefinition file (.DEF) or include__declspec(dllexpor t)on yourfunction definitions. Use__declspec(dllimport)to import thesefunctions into the client executable.
You must add theAFX_MANAGE_STATEmacro at the beginning of all the e xportedfunctions in regular DLLs that dynamically link to MFC to set the curr ent modulestate to the one for the DLL. This is done by adding the followingline of codeto the beginning of
functions exported from the DLL:
AFX_MANAGE_STATE(AfxGetStaticModuleState( ))
WinMain->DllMain
The MFC library defines the standard Win32DllMain entry point that initializ es yourCWinAppderived object as in a normal MFC application. Placeall DLL-specific initialization in theInitInstancememberfunction as in a normal MFC application.
相关文章推荐
- Training—Displaying Bitmaps Efficiently
- 解决 Agent admitted failure to sign using the key 问题 with ssh
- 根据main函数中对printchs函数的调用,以及printchs的功能要求,编写printchs函数
- set up size, title to tcl tk main window
- 数据绑定以及Container.DataItem几种方式与用法分析
- hdu_1039_Easier Done Than Said_201311051511
- rndc: connect failed: 127.0.0.1#953: connection refused
- LeetCode题解:Climbing Stairs
- Failed to fetch URL https://dl-ssl.google.com/android/repository/repository-6.xml, reason: Connection to https://dl-ssl.google.com refused
- Mac Os X 系统,Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-2.xml
- ArcMap 连接SDE 出错“Failed to connect to the specified server. Entry for SDE instance no found in services file.”
- repaint和reflow的相关知识
- 去掉DB_DOMAIN的方法
- Django filter中contains 用法
- Dell raid卡状态监控
- hdoj1022 Train Problem I ( stack )
- Handler sendMessage 与 obtainMessage (sendToTarget)比较
- 电子邮件营销在营销不同阶段的使用方法
- 1.cocaine Introduction
- Climbing Stairs