EDN Admin
Well-known member
Hi,
Ive been stuck with this error when I build a project in Visual Studio 2005
<font size=1>
mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in msvcrt.lib(dllmain.obj)
<font style="font-size:12px
I have a project that linked with a few libraries and some of the libraries use mfc.
</font>
<font style="font-size:12px I am using the compiler switch /MD and the libraries I linked with use MFC in a shared dll (or not use MFC) and are compiled with /MD switch too. (except some mozilla libs: xpcomglue_s.lib, etc, which I dont know)
I also tried to ignore mfcs80.lib and msvcrt.lib, then adding them back in the order of "mfcs80.lib msvcrt.lib"
</font>
<font style="font-size:12px It doesnt seem to help, I still get the error. I tried to use the link switch /verbose:lib and VS2005 prints out the libs it is searching. I noticed that all the libs I included are searched twice, and the error was given when mfcs80.lib is to be linked again. For example:
</font><font size=1>
Searching libraries
1> Searching C
rogram FilesMicrosoft Visual Studio 8VCatlmfclibmfcs80.lib:
1> Searching C
rogram FilesMicrosoft Visual Studio 8VClibmsvcrt.lib:
1> Searching ....third-partymozillagecko-sdk-1-8libxpcom.lib:
1> Searching ....third-partymozillagecko-sdk-1-8libxpcomglue_s.lib:
1> Searching ....third-partymozillagecko-sdk-1-8libnspr4.lib:
</font>...
<font size=1>
1> Searching C
rogram FilesMicrosoft Visual Studio 8VCPlatformSDKlibadvapi32.lib:
1> Searching C
rogram FilesMicrosoft Visual Studio 8VCPlatformSDKlibshell32.lib:
1> Searching C
rogram FilesMicrosoft Visual Studio 8VCPlatformSDKlibcomctl32.lib:
1> Searching C
rogram FilesMicrosoft Visual Studio 8VCPlatformSDKlibshlwapi.lib:
1> Searching C
rogram FilesMicrosoft Visual Studio 8VClibcomsupp.lib:
1> Searching C
rogram FilesMicrosoft Visual Studio 8VCPlatformSDKlibole32.lib:
1> Searching C
rogram FilesMicrosoft Visual Studio 8VCPlatformSDKliboleaut32.lib:
1> Searching C
rogram FilesMicrosoft Visual Studio 8VCPlatformSDKlibwbemuuid.lib:
1> Searching C
rogram FilesMicrosoft Visual Studio 8VCatlmfclibatls.lib:
1> Searching C
rogram FilesMicrosoft Visual Studio 8VCatlmfclibmfcs80.lib:
<font style="background-color:#ffff99 1>mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in msvcrt.lib(dllmain.obj)</font>
1> Searching C
rogram FilesMicrosoft Visual Studio 8VClibmsvcrt.lib:
1> Searching ....third-partymozillagecko-sdk-1-8libxpcom.lib:
1> Searching ....third-partymozillagecko-sdk-1-8libxpcomglue_s.lib:
1> Searching ....third-partymozillagecko-sdk-1-8libnspr4.lib:
</font>
<font style="font-size:12px Thanks!</font>
</font>
View the full article
Ive been stuck with this error when I build a project in Visual Studio 2005
<font size=1>
mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in msvcrt.lib(dllmain.obj)
<font style="font-size:12px
I have a project that linked with a few libraries and some of the libraries use mfc.
</font>
<font style="font-size:12px I am using the compiler switch /MD and the libraries I linked with use MFC in a shared dll (or not use MFC) and are compiled with /MD switch too. (except some mozilla libs: xpcomglue_s.lib, etc, which I dont know)
I also tried to ignore mfcs80.lib and msvcrt.lib, then adding them back in the order of "mfcs80.lib msvcrt.lib"
</font>
<font style="font-size:12px It doesnt seem to help, I still get the error. I tried to use the link switch /verbose:lib and VS2005 prints out the libs it is searching. I noticed that all the libs I included are searched twice, and the error was given when mfcs80.lib is to be linked again. For example:
</font><font size=1>
Searching libraries
1> Searching C

1> Searching C

1> Searching ....third-partymozillagecko-sdk-1-8libxpcom.lib:
1> Searching ....third-partymozillagecko-sdk-1-8libxpcomglue_s.lib:
1> Searching ....third-partymozillagecko-sdk-1-8libnspr4.lib:
</font>...
<font size=1>
1> Searching C

1> Searching C

1> Searching C

1> Searching C

1> Searching C

1> Searching C

1> Searching C

1> Searching C

1> Searching C

1> Searching C

<font style="background-color:#ffff99 1>mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in msvcrt.lib(dllmain.obj)</font>
1> Searching C

1> Searching ....third-partymozillagecko-sdk-1-8libxpcom.lib:
1> Searching ....third-partymozillagecko-sdk-1-8libxpcomglue_s.lib:
1> Searching ....third-partymozillagecko-sdk-1-8libnspr4.lib:
</font>
<font style="font-size:12px Thanks!</font>
</font>
View the full article