VC++ 2010 Express Linker library issues
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: VC++ 2010 Express Linker library issues

  1. #1
    Join Date
    Nov 2010
    Posts
    105

    Question VC++ 2010 Express Linker library issues

    All code compiled OK but link complained:

    Code:
    msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range@std@@YAXPBD@Z) already defined in libcpmt.lib(xthrow.obj)
    msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) already defined in libcpmt.lib(xthrow.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _memmove already defined in LIBCMT.lib(memmove.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in LIBCMT.lib(stdexcpt.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &,int)" (??0exception@std@@QAE@ABQBDH@Z) already defined in LIBCMT.lib(stdexcpt.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in LIBCMT.lib(stdexcpt.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: __gmtime64 already defined in LIBCMT.lib(gmtime64.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in LIBCMT.lib(stdexcpt.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) already defined in LIBCMT.lib(stdexcpt.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _tolower already defined in LIBCMT.lib(tolower.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isupper already defined in LIBCMT.lib(_ctype.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isalpha already defined in LIBCMT.lib(_ctype.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isspace already defined in LIBCMT.lib(_ctype.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strchr already defined in LIBCMT.lib(strchr.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isalnum already defined in LIBCMT.lib(_ctype.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isdigit already defined in LIBCMT.lib(_ctype.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isxdigit already defined in LIBCMT.lib(_ctype.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strncmp already defined in LIBCMT.lib(strncmp.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _floor already defined in LIBCMT.lib(_floor_pentium4_.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _sprintf already defined in LIBCMT.lib(sprintf.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _getenv already defined in LIBCMT.lib(getenv.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: __strnicmp already defined in LIBCMT.lib(strnicmp.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: __stricmp already defined in LIBCMT.lib(stricmp.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strrchr already defined in LIBCMT.lib(strrchr.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strerror already defined in LIBCMT.lib(strerror.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: __errno already defined in LIBCMT.lib(dosmap.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _isprint already defined in LIBCMT.lib(_ctype.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fclose already defined in LIBCMT.lib(fclose.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fopen already defined in LIBCMT.lib(fopen.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _localeconv already defined in LIBCMT.lib(lconv.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _ispunct already defined in LIBCMT.lib(_ctype.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fwrite already defined in LIBCMT.lib(fwrite.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strtol already defined in LIBCMT.lib(strtol.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strtod already defined in LIBCMT.lib(strtod.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _ceil already defined in LIBCMT.lib(_ceil_pentium4_.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _sscanf already defined in LIBCMT.lib(sscanf.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strncpy already defined in LIBCMT.lib(strncpy.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _atoi already defined in LIBCMT.lib(atox.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strcspn already defined in LIBCMT.lib(strcspn.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fgets already defined in LIBCMT.lib(fgets.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fprintf already defined in LIBCMT.lib(fprintf.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fputc already defined in LIBCMT.lib(fputc.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj)
    MSVCRT.lib(MSVCR100.dll) : error LNK2005: _islower already defined in LIBCMT.lib(_ctype.obj)
    MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
    MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
    LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
    Dash.obj : error LNK2019: unresolved external symbol "void __cdecl seticonfixed(class Fl_Window *)" (?seticonfixed@@YAXPAVFl_Window@@@Z) referenced in function _main
    LogToCSV.obj : error LNK2001: unresolved external symbol "void __cdecl seticonfixed(class Fl_Window *)" (?seticonfixed@@YAXPAVFl_Window@@@Z)
    UI.obj : error LNK2001: unresolved external symbol "void __cdecl seticonfixed(class Fl_Window *)" (?seticonfixed@@YAXPAVFl_Window@@@Z)
    It seems in some cases there is conflict between libraries and others it can't find the fltk library even though I specified fltk.lib. Please help. Thanks!

  2. #2
    Join Date
    Jul 2002
    Posts
    2,505

    Re: VC++ 2010 Express Linker library issues

    Code:
    LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
    Follow this advice. http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx

  3. #3
    Join Date
    Nov 2010
    Posts
    105

    Question Re: VC++ 2010 Express Linker library issues

    Thanks! It wasn't clear which ones to ignore though. So I tried

    1. Ignore all default libraries: many errors still
    2. Ignore msvcrt.lib and msvcprt.lib: still many errors
    3. Ignore libcmt.lib and libcpmt.lib: the fewest remaining errors (see below)


    Code:
    LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
    msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::locale::facet * __thiscall std::locale::facet::_Decref(void)" (?_Decref@facet@locale@std@@QAEPAV123@XZ) already defined in UI.obj
    Dash.obj : error LNK2019: unresolved external symbol "void __cdecl seticonfixed(class Fl_Window *)" (?seticonfixed@@YAXPAVFl_Window@@@Z) referenced in function _main
    LogToCSV.obj : error LNK2001: unresolved external symbol "void __cdecl seticonfixed(class Fl_Window *)" (?seticonfixed@@YAXPAVFl_Window@@@Z)
    UI.obj : error LNK2001: unresolved external symbol "void __cdecl seticonfixed(class Fl_Window *)" (?seticonfixed@@YAXPAVFl_Window@@@Z)
    UI.obj : error LNK2001: unresolved external symbol "private: static int std::locale::id::_Id_cnt" (?_Id_cnt@id@locale@std@@0HA)
    UI.obj : error LNK2001: unresolved external symbol "__int64 const std::_BADOFF" (?_BADOFF@std@@3_JB)
    UI.obj : error LNK2001: unresolved external symbol "public: static class std::locale::id std::ctype<char>::id" (?id@?$ctype@D@std@@2V0locale@2@A)
    UI.obj : error LNK2001: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > std::cout" (?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A)
    Still need help...

  4. #4
    Join Date
    Nov 2010
    Posts
    105

    Re: VC++ 2010 Express Linker library issues

    Finally figured it out. Need to ignore the VC libraries and recompile FLTK as static library.

  5. #5
    Join Date
    Nov 2010
    Posts
    105

    Re: VC++ 2010 Express Linker library issues

    Well I got a new laptop and the problem came back. I got a bunch of warnings and errors when the IDE tried to link the fltk library:
    1>fltkd.lib(Fl_File_Chooser2.obj) : error LNK2019: unresolved external symbol __imp___access referenced in function "private: void __thiscall Fl_File_Chooser::fileNameCB(void)" (?fileNameCB@Fl_File_Chooser@@AAEXXZ)
    1>fltkd.lib(Fl_File_Chooser2.obj) : error LNK2019: unresolved external symbol __imp__strstr referenced in function "char * __cdecl strstr(char *,char const *)" (?strstr@@YAPADPADPBD@Z)
    1>fltkd.lib(Fl_File_Chooser2.obj) : error LNK2019: unresolved external symbol __imp___mkdir referenced in function "private: void __thiscall Fl_File_Chooser::newdir(void)" (?newdir@Fl_File_Chooser@@AAEXXZ)
    1>fltkd.lib(Fl_File_Chooser2.obj) : error LNK2019: unresolved external symbol __imp__fread referenced in function "private: void __thiscall Fl_File_Chooser::update_preview(void)" (?update_preview@Fl_File_Chooser@@AAEXXZ)
    1>fltkd.lib(Fl_Text_Buffer.obj) : error LNK2001: unresolved external symbol __imp__fread
    1>fltkd.lib(Fl_Shared_Image.obj) : error LNK2001: unresolved external symbol __imp__fread
    1>fltkd.lib(Fl_Text_Buffer.obj) : error LNK2019: unresolved external symbol __imp__ferror referenced in function "public: int __thiscall Fl_Text_Buffer::insertfile(char const *,int,int)" ...
    Update: I figured it out. The fltk library was compiled with "debug" and the problem went away when it's re-compiled with "release". Although the fltk solution now fails to build 68 out of 79 projects.
    Last edited by acppdummy; July 13th, 2012 at 01:36 PM. Reason: add info

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center