链接报错:
错误 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.
 
经验证可行
 
转自 http://blog.csdn.net/tian_jinping/article/details/14168919
 
 
或使用如下方法,是的mfc库先于msvcrtd.lib链接
   _DllMain@12 已经在 MSVCRTD.lib(dllmain.obj) 中定义
   VC2005解决办法:
1)Debug版本:
项目-属性-链接器-输入:忽略特定库中输入mfc80d.lib;mfcs80d.lib
项目-属性-链接器-附加依赖项:mfc80d.lib;mfcs80d.lib
   就可以保证mfc80d和mfcs80d先于MSVCRTD.lib链接,OK,成功
2)Release版本
   与Debug版本不同在于mfc80.lib;mfcs80.lib

VS报错 error LNK2005: _DllMain@12 已经在 MSVCRTD.lib(dllmain.obj) 中定义的更多相关文章

  1. error LNK2005: _DllMain@12 已经在 MSVCRTD.lib(dllmain.obj) 中定义

    备注:我上次遇到这个问题是Win32 DLL项目中无意中include了afxwin.h,这个是MFC的头文件,把这个include删掉就解决了 ================ 转自:http:// ...

  2. (原)ippicvmt.lib(ippinit.obj) : error LNK2005: _ippSetCpuFeatures@8 已经在 ippcoremt.lib(ippinit.obj) 中定义

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5497234.html 参考网址: http://answers.opencv.org/question ...

  3. ZZmsvcprt.lib(MSVCP90.dll) : error LNK2005:已经在libcpmtd.lib(xmutex.obj) 中定义 .的分析解决办法 (转)

    很久没有写程式设计入门知识的相关文章了,这篇文章要来谈谈程式库 (Library) 连结,以及关于 MSVC 与 CRT 之间的种种恩怨情仇. 如果你使用的作业系统是 Linux.Mac 或其他非 W ...

  4. libcmt.lib(crt0dat.obj) : error LNK2005: _amsg_exit 已经在 MSVCRTD.lib(MSVCR110D.dll) 中定义

    问题描述(VC2012): 1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: 默认库"libcmt.lib"与其他库的使用冲突:请 ...

  5. error LNK2005: _DllMain@12 已经在 dllmain.obj 中定义

    error LNK2005: _DllMain@ 已经在 dllmain.obj 中定义 今天遇到了同样的问题,搜索搜到了这里,后来解决了........ 创建解决方案时,用的是WIN32 DLL,添 ...

  6. win32 Dll 中添加afx.h 出现如下错误 error LNK2005: _DllMain@12 already defined

    win32 Dll 中添加afx.h 出现如下错误 nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in ...

  7. 封装dll遇到的奇葩错误:error LNK2005: _DllMain@12 已经在 DLLMain.obj 中定义

    在定义一个dll工程的时候,一添加MFC的头文件就会报出这个 错误:error LNK2005: _DllMain@12 已经在 DLLMain.obj 中定义  既蛋疼又蛋疼!! 然后逛论坛,查资料 ...

  8. VC编译错误: Nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12已经在dllmain.obj 中定义

    错误: Nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12已经在dllmain.obj 中定义 解决: 打开项目属性对话框, C/C++ -& ...

  9. mfcs100d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)

    转自VC错误:http://www.vcerror.com/?p=55 问题描述: mfcs100d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 al ...

随机推荐

  1. IOS中 浅谈iOS中MVVM的架构设计与团队协作

    今天写这篇文章是想达到抛砖引玉的作用,想与大家交流一下思想,相互学习,博文中有不足之处还望大家批评指正.本篇文章的内容沿袭以往博客的风格,也是以干货为主,偶尔扯扯咸蛋(哈哈~不好好工作又开始发表博客啦 ...

  2. 03 EditText文本编辑框

    二  EditText   文本编辑框  父类: TextView     >概念:文本编辑框  可以进行文本编辑         android:textColor="#00f&qu ...

  3. SendMessageUpwards定义简单按钮(Unity3D开发之十)

    猴子原创,欢迎转载.转载请注明: 转载自Cocos2D开发网–Cocos2Dev.com,谢谢! 原文地址: http://www.cocos2dev.com/?p=582 SendMessageUp ...

  4. int*p[ ]与int(*p)[ ]的不同

    举例说明: 1)int* p[2] 是一个指向int型的指针数组,即:p是包含两个元素的指针数组,指针指向的是int型. 可以这样来用: #include <iostream> using ...

  5. SQL2008清除数据库日志脚本

    --数据库名称sjjhzx,日志文件名称ksoa_zuizhong_Log' USE sjjhzx    GO    ALTER DATABASE sjjhzx SET RECOVERY SIMPLE ...

  6. (三十九)数据的持久化存储-plist实现(XML属性表)

    iOS应用数据存储的常用方式: 归档:用某种格式保存数据. XML属性列表(plist)归档(持久化) Preference 偏好设置 NSKeyedArchiver归档 SQLite3 数据库 效率 ...

  7. Iterm2安装Zsh + Oh My Zsh+Solarized

    安装Oh My Zsh curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh 安装Zsh ...

  8. mysql进阶(十九)SQL语句如何精准查找某一时间段的数据

    SQL语句如何精准查找某一时间段的数据 在项目开发过程中,自己需要查询出一定时间段内的交易.故需要在sql查询语句中加入日期时间要素,sql语句如何实现? SELECT * FROM lmapp.lm ...

  9. 【一天一道LeetCode】#24. Swap Nodes in Pairs

    一天一道LeetCode系列 (一)题目 Given a linked list, swap every two adjacent nodes and return its head. For exa ...

  10. 【面试笔试算法】Program 4 : Best Compression Algorithms(网易游戏笔试题)

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 易信是由网易和电信联合开发的一款即时通讯软件.除了语音聊天,免费电话等新功能以外,传统的文字信息聊天功能也得以保留,因此每 ...