Errors when linking with mozcrt.lib

Talk about add-ons and extension development.
Post Reply
nmaddix
Posts: 28
Joined: January 25th, 2009, 11:27 pm

Errors when linking with mozcrt.lib

Post by nmaddix »

So it seems that as of Firefox 40, xpcomglue_s_nomozalloc.lib is no more and it's now preferred to use mozcrt.lib as per the following: https://bugzilla.mozilla.org/show_bug.cgi?id=1168291

So I tried linking my XPCOM extension against mozcrt.lib. I also added MOZ_CRT and removed MOZ_NO_MOZALLOC preprocessor definitions. Got the following errors. Can't find documentation anywhere on how to use this stuff. Any tips?

Code: Select all

1>nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in mozcrt.lib(dllmain.obj)
1>nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in Extension.obj
1>nafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in Extension.obj
1>nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in Extension.obj
1>nafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in Extension.obj
1>libcmt.lib(sprintf.obj) : error LNK2005: _sprintf already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: _exit already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(vsnprnc.obj) : error LNK2005: _vsprintf_s already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(atox.obj) : error LNK2005: _atoi already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(winapisupp.obj) : error LNK2005: ___crtTerminateProcess already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(winapisupp.obj) : error LNK2005: ___crtUnhandledException already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(vsprintf.obj) : error LNK2005: __vscprintf already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(winxfltr.obj) : error LNK2005: ___CppXcptFilter already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(tolower.obj) : error LNK2005: _tolower already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in mozcrt.lib(cinitexe.obj)
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in mozcrt.lib(cinitexe.obj)
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in mozcrt.lib(cinitexe.obj)
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in mozcrt.lib(cinitexe.obj)
1>libcmt.lib(strtol.obj) : error LNK2005: _strtoul already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(fpinit.obj) : error LNK2005: __fltused already defined in a previous module
1>libcmt.lib(fpinit.obj) : error LNK2005: __ldused already defined in a previous module
1>libcmt.lib(mlock.obj) : error LNK2005: __lock already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(mlock.obj) : error LNK2005: __unlock already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(crtheap.obj) : error LNK2005: __calloc_crt already defined in mozcrt.lib(MSVCR120.dll)
1>libcmt.lib(crtheap.obj) : error LNK2005: __malloc_crt already defined in mozcrt.lib(MSVCR120.dll)

1>LINK : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>ExtensionModule.obj : error LNK2001: unresolved external symbol "public: virtual enum nsresult __stdcall mozilla::GenericModule::QueryInterface(struct nsID const &,void * *)" (?QueryInterface@GenericModule@mozilla@@UAG?AW4nsresult@@ABUnsID@@PAPAX@Z)
1>ExtensionModule.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __stdcall mozilla::GenericModule::AddRef(void)" (?AddRef@GenericModule@mozilla@@UAGKXZ)
1>ExtensionModule.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __stdcall mozilla::GenericModule::Release(void)" (?Release@GenericModule@mozilla@@UAGKXZ)
1>ExtensionModule.obj : error LNK2001: unresolved external symbol "public: virtual enum nsresult __stdcall mozilla::GenericModule::GetClassObject(class nsIComponentManager *,struct nsID const &,struct nsID const &,void * *)" (?GetClassObject@GenericModule@mozilla@@UAG?AW4nsresult@@PAVnsIComponentManager@@ABUnsID@@1PAPAX@Z)
1>ExtensionModule.obj : error LNK2001: unresolved external symbol "public: virtual enum nsresult __stdcall mozilla::GenericModule::RegisterSelf(class nsIComponentManager *,class nsIFile *,char const *,char const *)" (?RegisterSelf@GenericModule@mozilla@@UAG?AW4nsresult@@PAVnsIComponentManager@@PAVnsIFile@@PBD2@Z)
1>ExtensionModule.obj : error LNK2001: unresolved external symbol "public: virtual enum nsresult __stdcall mozilla::GenericModule::UnregisterSelf(class nsIComponentManager *,class nsIFile *,char const *)" (?UnregisterSelf@GenericModule@mozilla@@UAG?AW4nsresult@@PAVnsIComponentManager@@PAVnsIFile@@PBD@Z)
1>ExtensionModule.obj : error LNK2001: unresolved external symbol "public: virtual enum nsresult __stdcall mozilla::GenericModule::CanUnload(class nsIComponentManager *,bool *)" (?CanUnload@GenericModule@mozilla@@UAG?AW4nsresult@@PAVnsIComponentManager@@PA_N@Z)
1> fatal error LNK1120: 7 unresolved externals
Post Reply