error LNK2005: _DllMain@12 already defined in MSVCRT.lib

前端 未结 17 2070
臣服心动
臣服心动 2020-12-14 06:44

I am getting this linker error.

mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj)

17条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-14 07:04

    In my project I was able to solve this problem by adding mfcs80.lib and msvcrt.lib as additional dependencies in the project settings. The 'additional dependencies' can be found under Linker -> Input.

    In the debug configuration that would have to be mfcs80d.lib and msvcrtd.lib respectively.

    By the way, I am working with Visual Studio 2010, so in my case the MFC lib is called mfc100.lib.

    I am not sure why this worked. It is not necessary to add these lib files as additional dependencies because I already set 'Use of MFC' to 'Use MFC in a shared dll'. I guess that by specifying these libraries as additional dependencies they are linked in a different order.

    This solution is more or less the same as the one suggested on the Microsoft site: http://support.microsoft.com/kb/148652, except I did not need to type anything in the 'Ignore specific default libraries' box.

提交回复
热议问题