Random Linker Error
-
I have an ActiveX control that I wrote a while ago. It compiled fine then, but when I accidently hit "Rebuild All" today, I got the following output:
--------------------Configuration: PilotImport - Win32 Debug-------------------- Creating Type Library... Processing C:\My Projects\Completed Components\PilotImport\PilotImport.odl PilotImport.odl Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\oaidl.idl oaidl.idl Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\objidl.idl objidl.idl Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\unknwn.idl unknwn.idl Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\wtypes.idl wtypes.idl Compiling resources... Compiling... StdAfx.cpp Compiling... Pilot_Import.c PilotImport.cpp PilotImportCtl.cpp PilotImportPpg.cpp Linking... 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 Creating library Debug/PilotImport.lib and object Debug/PilotImport.exp Debug/PilotImport.ocx : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. PilotImport.ocx - 2 error(s), 1 warning(s)
Nothing in the code has changed -- does anyone know why this linker error suddenly popped up? I got around this with another project by completely remaking the project, but this requires a lot of retyping. Thanks Zac "If I create everything new, why would I want to delete anything?" -
I have an ActiveX control that I wrote a while ago. It compiled fine then, but when I accidently hit "Rebuild All" today, I got the following output:
--------------------Configuration: PilotImport - Win32 Debug-------------------- Creating Type Library... Processing C:\My Projects\Completed Components\PilotImport\PilotImport.odl PilotImport.odl Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\oaidl.idl oaidl.idl Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\objidl.idl objidl.idl Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\unknwn.idl unknwn.idl Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\wtypes.idl wtypes.idl Compiling resources... Compiling... StdAfx.cpp Compiling... Pilot_Import.c PilotImport.cpp PilotImportCtl.cpp PilotImportPpg.cpp Linking... 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 Creating library Debug/PilotImport.lib and object Debug/PilotImport.exp Debug/PilotImport.ocx : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. PilotImport.ocx - 2 error(s), 1 warning(s)
Nothing in the code has changed -- does anyone know why this linker error suddenly popped up? I got around this with another project by completely remaking the project, but this requires a lot of retyping. Thanks Zac "If I create everything new, why would I want to delete anything?"Nevermind, I found out why it is doing this. As it turns out, this is caused by the CRT being linked before MFC (I still don't understand how it gets in a state where this occurs since nothing had changed in the code, but oh well). The solution is in a knowledge base article: http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q148652& "If I create everything new, why would I want to delete anything?"