FAGClientDLL.cpp
Linking...
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in FAGClientDLL.obj
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in FAGClientDLL.obj; second definition ignored
   Creating library Debug/FAGClientDLL.lib and object Debug/FAGClientDLL.exp
Debug/FAGClientDLL.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.FAGClientDLL.dll - 2 error(s), 1 warning(s)

解决方案 »

  1.   

    你可能是多定义了winmain(),应该是程序已经内置了最好还是吧源代码贴出来并说出你的目的否则别人很难帮你
      

  2.   

    设置你的工程属性:
    Project Settings -> C/C++ -> Code Generation
    用户运行库选Muitithreaded DLL
      

  3.   

    you maybe add MFC support in ATL project,because it already has dllmain in project, but you add include like #include <afxwin.h>
    #include <afxdisp.h> statement.
    you can solute it, by replace extern "C"
    BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
    {
        if (dwReason == DLL_PROCESS_ATTACH)
        {
            _Module.Init(ObjectMap, hInstance, &LIBID_COMTESTLib);
            DisableThreadLibraryCalls(hInstance);
        }
        else if (dwReason == DLL_PROCESS_DETACH)
            _Module.Term();
        return TRUE;    // ok
    }with class CXXXApp : public CWinApp
    {
    public:// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CTestMFCApp)
    public:
        virtual BOOL InitInstance();
        virtual int ExitInstance();
    //}}AFX_VIRTUAL //{{AFX_MSG(CXXXApp)
    // NOTE - the ClassWizard will add and remove member functions here.
    //    DO NOT EDIT what you see in these blocks of generated code !
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };BEGIN_MESSAGE_MAP(CXXXApp, CWinApp)
    //{{AFX_MSG_MAP(CXXXApp)
    // NOTE - the ClassWizard will add and remove mapping macros here.
    //    DO NOT EDIT what you see in these blocks of generated code!
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()CXXXApp theApp;BOOL CXXXApp::InitInstance()
    {
        _Module.Init(ObjectMap, m_hInstance, &LIBID_TESTMFCLib);
        return CWinApp::InitInstance();
    }int CXXXApp::ExitInstance()
    {
        _Module.Term();
        return CWinApp::ExitInstance();
    }
      

  4.   

    我用向导建立了一个win32 dll,然后不知道是不是我误删除了DLLMain(入口),
    结果编译竟然是正常的,后来我把DLLMAIN加上了,反而不正常了.编译时候就是上面写的错误,win32 dll 和mfc dll有什么区别吗?
      

  5.   

    MFC DLL已封装好了DLLMain,不要再加。CXXXApp::InitInstance()相当于DLLMain里的case DLL_PROCESS_ATTACH:
    CXXXApp::ExitInstance()相当于DLLMain里的case DLL_PROCESS_DETACH:
      

  6.   

    这个问题解决了,新问题有出来了,不知道哪位有空, 能帮我看一下,留下地址:
    我的[email protected]