Project

General

Profile

errors on linking with exiv2

Added by B Watson over 5 years ago

On linking an application trying to use exiv2, a number of errors are listed - most of them appear to be conflict errors. Is there are way to avoid these? Thanks. VC++ 2008 Express version. wxWidgets library.

1>Linking...
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: class std::locale::facet * _thiscall std::locale::facet::_Decref(void)" (?_Decref@facet@locale@std@QAEPAV123@XZ) already defined in libexiv2.lib(xmp.obj)
1>libcpmtd.lib(ios.obj) : error LNK2005: "private: static void __cdecl std::ios_base::_Ios_base_dtor(class std::ios_base *)" (?_Ios_base_dtor@ios_base@std
@CAXPAV12@Z) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmtd.lib(ios.obj) : error LNK2005: "public: static void __cdecl std::ios_base::_Addstd(class std::ios_base *)" (?_Addstd@ios_base@std
@SAXPAV12@Z) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmtd.lib(locale0.obj) : error LNK2005: "void __cdecl _AtModuleExit(void (__cdecl*)(void))" (?_AtModuleExit
@YAXP6AXXZ@Z) already defined in msvcprt.lib(locale0_implib.obj)
1>libcpmtd.lib(locale0.obj) : error LNK2005: __Fac_tidy already defined in msvcprt.lib(locale0_implib.obj)
1>libcpmtd.lib(locale0.obj) : error LNK2005: "private: static void __cdecl std::locale::facet::facet_Register(class std::locale::facet *)" (?facet_Register@facet@locale@std@CAXPAV123@Z) already defined in msvcprt.lib(locale0_implib.obj)
1>libcpmtd.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@CAPAV_Locimp@12@XZ) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmtd.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(void)" (?_Init@locale@std
@CAPAV_Locimp@12@XZ) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmtd.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?_Locinfo_ctor@_Locinfo@std@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@V?$allocator@D@2@2@Z) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmtd.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?_Locinfo_dtor@_Locinfo@std@SAXPAV12@Z) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@QAE@H@Z) already defined in msvcprt.lib(MSVCP90.dll)
1>libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std
@QAE@XZ) already defined in msvcprt.lib(MSVCP90.dll)
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@QAE@XZ) already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std
@QAE@ABQBD@Z) already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@QAE@ABV01@Z) already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@UAE@XZ) already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std
@UBEPBDXZ) already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::bad_cast::bad_cast(char const *)" (??0bad_cast@std@QAE@PBD@Z) already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::bad_cast::bad_cast(class std::bad_cast const &)" (??0bad_cast@std
@QAE@ABV01@Z) already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall std::bad_cast::~bad_cast(void)" (??1bad_cast@std
@UAE@XZ) already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(setlocal.obj) : error LNK2005: _setlocale already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(strftime.obj) : error LNK2005: _strftime already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(lconv.obj) : error LNK2005: _localeconv already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(mbstowcs.obj) : error LNK2005: _mbstowcs already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf_s already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(wcstombs.obj) : error LNK2005: _wcstombs already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: _
_xi_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: __xi_z already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: _
_xc_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: __xc_z already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(tzset.obj) : error LNK2005: __tzset already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(stricmp.obj) : error LNK2005: __stricmp already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(vsnprnc.obj) : error LNK2005: _vsprintf_s already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(vsnprnc.obj) : error LNK2005: __vsnprintf_s already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(vsnprnc.obj) : error LNK2005: __vsprintf_p already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(printf.obj) : error LNK2005: _printf already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(errmode.obj) : error LNK2005: _
_set_app_type already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(getenv.obj) : error LNK2005: getenv already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(tolower.obj) : error LNK2005: _tolower already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(_file.obj) : error LNK2005: _
_iob_func already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in MSVCRT.lib(MSVCR90.dll)
1>LIBCMTD.lib(strnicmp.obj) : error LNK2005: __strnicmp already defined in MSVCRT.lib(MSVCR90.dll)
1>libexpat.lib(xmlparse.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library


Replies (4)

RE: errors on linking with exiv2 - Added by Robin Mills over 5 years ago

I believe you are attempting to link static and dynamic libraries. LIBCMTD.lib is the Static /MT Debug library. MSVCRT.lib(MSVCr90.dll) is the dynamic (/MD) library. So you are mixing static and dynamic linking. I recommend that you use /MD (dynamic linking). Have a look at msvc2005/exifprint and you'll see how these are successfully linked for the 4 configurations: Release/ReleaseDLL/Debug/DebugDLL. Replace the code in exifprint.cpp with your code, and you should be in good shape. If you're still stuck, please send me your code and project files and I'll fix them for you. If you want to keep your code private and confidential, email it to

RE: errors on linking with exiv2 - Added by B Watson over 5 years ago

Thanks for heads-up. I have it working now.

RE: errors on linking with exiv2 - Added by B Watson over 5 years ago

However, I have a problem in the first call to the library. On debugging, the Open routine has a <Bad Ptr>, while the calling routine does not appear to have a problem. Please see file dump. Thanks.

RE: errors on linking with exiv2 - Added by Robin Mills over 5 years ago

Mr Watson:

I'll help you. Can you run your file through our sample applications such as exiv2.exe or exifprint.exe.

If you're stuck, please bundle up your code/projects/solution files and email them to me. I'll fix 'em for you.

Robin

    (1-4/4)