这个这个dll的编译过程中,为了用到MFC的类,我在StdAfx.h文件中
注释掉了#include <windows.h>,加上mfc的一些头文件,如下//#include <windows.h>
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 但是编译过程中出现如下问题,不知道怎么办,烦了好几天了,高手们请帮忙
Linking...
Nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in VnetMenu.obj
Nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in VnetMenu.obj; second definition ignored
Creating library Debug/VnetMenu.lib and object Debug/VnetMenu.exp
Debug/VnetMenu.dll : fatal error LNK1169: one or more multiply defined symbols found为了它,头发都掉了很多了。
注释掉了#include <windows.h>,加上mfc的一些头文件,如下//#include <windows.h>
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 但是编译过程中出现如下问题,不知道怎么办,烦了好几天了,高手们请帮忙
Linking...
Nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in VnetMenu.obj
Nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in VnetMenu.obj; second definition ignored
Creating library Debug/VnetMenu.lib and object Debug/VnetMenu.exp
Debug/VnetMenu.dll : fatal error LNK1169: one or more multiply defined symbols found为了它,头发都掉了很多了。
Open the Project Settings dialog box by clicking Settings on the Build menu.
In the Settings For view, click to select (highlight) the project configuration that is getting the link errors.
Click the Link tab.
Click to select INPUT in the Category combo box.
In the Libraries to Ignore edit box, insert the library names (for example, Nafxcwd.lib Libcmtd.lib). NOTE: The linker command-line equivalent in /NOD:<library name>.
In the Object/library Modules edit box, insert the library names. You must ensure that these are listed in order and as the first two libraries in the line (for example, Nafxcwd.lib Libcmtd.lib).
Solution Two: Locate and Correct the Problem Module
Perform the following steps to view the current library link order:
Open the Project Settings dialog box by clicking Settings on the Build menu.
In the Settings For view, click to select (highlight) the project configuration that is getting the link errors.
Click the Link tab.
Type the following in the Project Options dialog box:
/verbose:lib
Rebuild your project. The libraries will be listed in the output window during the linking process.
MSDN:
PRB: LNK2005 Errors When Link C Run-Time Libraries Are Linked Before MFC Libraries Q148652
To:laiyiling(最熟悉的陌生人) ,不清楚,可能是dll跟mfc里面的冲突,但不知道怎么解决!!
网上也也有出现类似的问题,但是没有相应的解决方法,惨。
你的Dll里面也有DllMain~
如果你的DllMain里没有做什么工作,就扔掉它
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}但请问一下,去掉向导的DLLMian,编译出来出来的dll在让其他程序调用的时候,应该没有问题吧??
DllMain主要是做一些初始化的工作,你不初始化就没影响,在你的情况下,它默认调用的应该是MFC库的DllMain