编译DLL时出现
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj); second definition ignored
两条LNK错误,是什么原因?

解决方案 »

  1.   

    可能是定义dll的时候,工程文件没有配好,我一般是选择建立一个简单dll工程,然后再自己添加程序
      

  2.   

    Linker Tools Error LNK2005
    symbol already defined in objectThe given symbol, displayed in its decorated form, was multiply defined.TipsOne of the following may be a cause: The most common cause of this error is accidentally linking with both the single-threaded and multithreaded libraries. Ensure that the application project file includes only the appropriate libraries and that any third-party libraries have appropriately created single-threaded or multithreaded versions.
    The given symbol was a packaged function (created by compiling with /Gy) and was included in more than one file but was changed between compilations. Recompile all files that include the symbol.
    The given symbol was defined differently in two member objects in different libraries, and both member objects were used.
    An absolute was defined twice, with a different value in each definition.
      

  3.   

    Linker Tools Warning LNK4006
    symbol already defined in object; second definition ignoredThe given symbol, displayed in its decorated form, was multiply defined. When this warning is encountered, symbol will be added twice, but only its first form will be used.Tips The given symbol may be a packaged function, created by compiling with /Gy. This symbol was included in more than one file but was changed between compilations. Recompile all files that include the symbol.
    The given symbol may have been defined differently in two member objects in different libraries.
    An absolute may have been defined twice, with a different value in each definition.
    If the error message is received when combining libraries, symbol already exists in the library being added to. 
    If you are rebuilding the C run-time library, you can ignore this message.