0

I have this old project I am assigned to look after now. It includes 2 dll-s and a an ocx written on .net 2003 C++ which communicate between each other and a bigger application. I need to make changes to them but when I try to build the ocx I get 8 LNK2019 unresolved external errors which I don't know how to fix. One of the dll-s also has these LNK2019 errors when I build the entire solution but it still produces the .dll. As far as I know the projects are not changed since the last time the previous guy built them successfuly. I don't think there is anything wrong with the code or project settings. I am using oracle virtual machine with windows xp to be able to run .net 2003.

The errors output:

mfcs42.lib(dllmodul.obj) : error LNK2019: unresolved external symbol "public: __thiscall AFX_MODULE_STATE::AFX_MODULE_STATE(int,long (__stdcall*)(struct HWND__ *,unsigned int,unsigned int,long),unsigned long)" (??0AFX_MODULE_STATE@@QAE@HP6GJPAUHWND__@@IIJ@ZK@Z) referenced in function "public: __thiscall _AFX_DLL_MODULE_STATE::_AFX_DLL_MODULE_STATE(void)" (??0_AFX_DLL_MODULE_STATE@@QAE@XZ)
mfcs42.lib(dllmodul.obj) : error LNK2019: unresolved external symbol "public: __thiscall AFX_MAINTAIN_STATE2::AFX_MAINTAIN_STATE2(class AFX_MODULE_STATE *)" (??0AFX_MAINTAIN_STATE2@@QAE@PAVAFX_MODULE_STATE@@@Z) referenced in function "long __stdcall AfxWndProcDllStatic(struct HWND__ *,unsigned int,unsigned int,long)" (?AfxWndProcDllStatic@@YGJPAUHWND__@@IIJ@Z)
mfcs42.lib(oleexp.obj) : error LNK2001: unresolved external symbol "public: __thiscall AFX_MAINTAIN_STATE2::AFX_MAINTAIN_STATE2(class AFX_MODULE_STATE *)" (??0AFX_MAINTAIN_STATE2@@QAE@PAVAFX_MODULE_STATE@@@Z)
mfcs42.lib(dllmodul.obj) : error LNK2019: unresolved external symbol "void __stdcall AfxTermExtensionModule(struct AFX_EXTENSION_MODULE &,int)" (?AfxTermExtensionModule@@YGXAAUAFX_EXTENSION_MODULE@@H@Z) referenced in function _DllMain@12
mfcs42.lib(dllmodul.obj) : error LNK2019: unresolved external symbol "class AFX_MODULE_STATE * __stdcall AfxSetModuleState(class AFX_MODULE_STATE *)" (?AfxSetModuleState@@YGPAVAFX_MODULE_STATE@@PAV1@@Z) referenced in function _DllMain@12
mfcs42.lib(dllmodul.obj) : error LNK2019: unresolved external symbol "public: __thiscall CDynLinkLibrary::CDynLinkLibrary(struct AFX_EXTENSION_MODULE &,int)" (??0CDynLinkLibrary@@QAE@AAUAFX_EXTENSION_MODULE@@H@Z) referenced in function _DllMain@12
mfcs42.lib(dllmodul.obj) : error LNK2019: unresolved external symbol "int __stdcall AfxInitExtensionModule(struct AFX_EXTENSION_MODULE &,struct HINSTANCE__ *)" (?AfxInitExtensionModule@@YGHAAUAFX_EXTENSION_MODULE@@PAUHINSTANCE__@@@Z) referenced in function _DllMain@12
mfcs42.lib(dllmodul.obj) : error LNK2019: unresolved external symbol "void __stdcall AfxCoreInitModule(void)" (?AfxCoreInitModule@@YGXXZ) referenced in function _DllMain@12
libcmt.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
.\..\DLL\ImpDplanX.ocx : fatal error LNK1120: 8 unresolved externals

I read the proposed solutions but didn't understand how to determine what is the real cause from all the possible ones listed. Or how to fix it.

mertol
  • 1
  • 2

1 Answers1

1

Linker errors can have multiple causes:

  1. Updated environment where symbol(s) were removed from libraries
  2. Unsatisfied dependencies on the environment, i.e. a library is too old to contain specific symbol(s)
  3. Missing source files that defined these symbol(s)
  4. Wrong build environment (wrong linker flags, search paths etc.)
  5. Build is done wrong (maybe some dependencies are not made explicit to the build system and need to be preserved manually by building certain subprojects in a certain order)

Without further information it is nearly impossible to say what the issue is.

dom0
  • 7,356
  • 3
  • 28
  • 50
  • What information do you need? I can upload the entire project if needed. Is that allowed here since it won't even let me to attach a picture? – mertol Oct 08 '14 at 14:46