Results 1 to 8 of 8
  1. #1
    What's that...? mesman00's Avatar
    Join Date
    Nov 2001
    Location
    USA
    Posts
    1,425
    Mentioned
    0 Post(s)

    ucontrollable linker errors

    i'm working on this project and i am getting an insane amount of linker errors, which i can't seem to find the source of. i don't know if there is something in the setting which i need to configure, etc. here are the errors i am recieving:

    Code:
    --------------------Configuration: dcmsrview32 - Win32 Debug--------------------
    Compiling...
    dcmsrview32.cpp
    Linking...
    libcpmtd.lib(locale0.obj) : error LNK2005: "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int,bool)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(locale0.obj) : error LNK2005: "public: bool __thiscall std::locale::_Iscloc(void)const " (?_Iscloc@locale@std@@QBE_NXZ) already defined in msvcprtd.lib(MSVCP60D.dll)
    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 msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(ios.obj) : error LNK2005: "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(ios.obj) : error LNK2005: "public: virtual __thiscall std::ios_base::~ios_base(void)" (??1ios_base@std@@UAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(ios.obj) : error LNK2005: "protected: void __thiscall std::ios_base::_Addstd(void)" (?_Addstd@ios_base@std@@IAEXXZ) already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(ios.obj) : error LNK2005: "protected: void __thiscall std::ios_base::_Init(void)" (?_Init@ios_base@std@@IAEXXZ) already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(locale.obj) : error LNK2005: "public: class std::locale & __thiscall std::locale::_Addfac(class std::locale::facet *,unsigned int,unsigned int)" (?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z) already defined in msvcprtd.lib(MSVCP60D.d
    ll)
    libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall std::_Locinfo::~_Locinfo(void)" (??1_Locinfo@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(xwctomb.obj) : error LNK2005: __Getcvt already defined in msvcprtd.lib(MSVCP60D.dll)
    LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(lconv.obj) : error LNK2005: _localeconv already defined in msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj)
    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj)
    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj)
    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj)
    LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in msvcrtd.lib(MSVCRTD.dll)
    msvcrtd.lib(MSVCRTD.dll) : error LNK2005: __setmbcp already defined in LIBCMTD.lib(mbctype.obj)
    libcpmtd.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
    LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
    LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
    LIBCMTD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/dcmsrview32.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    
    dcmsrview32.exe - 29 error(s), 2 warning(s)
    i am using visual c++ 6.0. are there any linker setting i need to set in order to eliminate these errors. i know this description is rather vague, but i really don't know what else to include. if you need any other info let me know. thanks. btw, i am using MFC.

    <font color="blue">System Specs</font>
    Dual Boot:
    1. Gentoo Linux
    2. Win2k
    Athlon XP Barton 2700
    512 MB PC 2700 DDR Ram
    GF4 Ti4200 AGP 8X 64 MB
    Onboard Sound


    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  2. #2
    What's that...? mesman00's Avatar
    Join Date
    Nov 2001
    Location
    USA
    Posts
    1,425
    Mentioned
    0 Post(s)
    ok, i have limited it now to 3 errors and 6 warnings by ignoring the libraries msvcrtd.lib and msvcprtd.lib. now this is the output after linking:

    Code:
    --------------------Configuration: dcmsrview32 - Win32 Debug--------------------
    Linking...
    LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ)" imported
    LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ)" imported
    LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Winit::_Winit(void)" (??0_Winit@std@@QAE@XZ)" imported
    LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Winit::~_Winit(void)" (??1_Winit@std@@QAE@XZ)" imported
    LINK : warning LNK4049: locally defined symbol "__assert" imported
    LINK : warning LNK4049: locally defined symbol "__setmbcp" imported
    convert.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::`vbase destructor'(void)" (__imp_??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXX
    Z)
    convert.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::basic_ofstream<char,struct std::char_traits<char> >(char const *,int)" (__imp_??0?$basic_ofst
    ream@DU?$char_traits@D@std@@@std@@QAE@PBDH@Z)
    Debug/dcmsrview32.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.
    
    dcmsrview32.exe - 3 error(s), 6 warning(s)
    <font color="blue">System Specs</font>
    Dual Boot:
    1. Gentoo Linux
    2. Win2k
    Athlon XP Barton 2700
    512 MB PC 2700 DDR Ram
    GF4 Ti4200 AGP 8X 64 MB
    Onboard Sound

  3. #3
    Moderator aprentice's Avatar
    Join Date
    Nov 2001
    Posts
    1,390
    Mentioned
    0 Post(s)
    Quote Originally Posted by mesman00
    ok, i have limited it now to 3 errors and 6 warnings by ignoring the libraries msvcrtd.lib and msvcprtd.lib. now this is the output after linking:

    Code:
    --------------------Configuration: dcmsrview32 - Win32 Debug--------------------
    Linking...
    LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ)" imported
    LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ)" imported
    LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Winit::_Winit(void)" (??0_Winit@std@@QAE@XZ)" imported
    LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Winit::~_Winit(void)" (??1_Winit@std@@QAE@XZ)" imported
    LINK : warning LNK4049: locally defined symbol "__assert" imported
    LINK : warning LNK4049: locally defined symbol "__setmbcp" imported
    convert.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::`vbase destructor'(void)" (__imp_??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXX
    Z)
    convert.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::basic_ofstream<char,struct std::char_traits<char> >(char const *,int)" (__imp_??0?$basic_ofst
    ream@DU?$char_traits@D@std@@@std@@QAE@PBDH@Z)
    Debug/dcmsrview32.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.
    
    dcmsrview32.exe - 3 error(s), 6 warning(s)
    your missing a library

  4. #4
    What's that...? mesman00's Avatar
    Join Date
    Nov 2001
    Location
    USA
    Posts
    1,425
    Mentioned
    0 Post(s)
    that is what i thought. in my code i am using the iostream library to write data to a file. however, if i comment out #include <iostream> and all the code that uses the library, it will link without any errors. so what is the relation here?
    <font color="blue">System Specs</font>
    Dual Boot:
    1. Gentoo Linux
    2. Win2k
    Athlon XP Barton 2700
    512 MB PC 2700 DDR Ram
    GF4 Ti4200 AGP 8X 64 MB
    Onboard Sound

  5. #5
    Moderator smcd's Avatar
    Join Date
    Jun 2004
    Posts
    2,532
    Mentioned
    0 Post(s)
    You need to link to the runtime library, either libcp.lib or libcpmt.lib?

    You were linking with both the static (LIBCPMT) runtime library AND the dynamic (MSVCRT) together, it appears. Since it was in debug mode, they'd be called "libcmtd.lib" and "msvcrtd.lib"

    By linking a multi-threaded version (that gets statically included) along with a possibly singled-threaded only dynamic library (I am not sure if MSVCRT.LIB, which results in the use of MSVCRT.DLL runtime, is thread-safe or not?) you might introduce other errors into the execution of your program later down the line as well.
    Last edited by smcd; June 23rd, 2004 at 18:10.

  6. #6
    What's that...? mesman00's Avatar
    Join Date
    Nov 2001
    Location
    USA
    Posts
    1,425
    Mentioned
    0 Post(s)
    Quote Originally Posted by sethmcdoogle
    You need to link to the runtime library, either libcp.lib or libcpmt.lib?

    You were linking with both the static (LIBCPMT) runtime library AND the dynamic (MSVCRT) together, it appears. Since it was in debug mode, they'd be called "libcmtd.lib" and "msvcrtd.lib"

    By linking a multi-threaded version (that gets statically included) along with a possibly singled-threaded only dynamic library (I am not sure if MSVCRT.LIB, which results in the use of MSVCRT.DLL runtime, is thread-safe or not?) you might introduce other errors into the execution of your program later down the line as well.
    you say i am linking with the static and dynamic libraries. thus, how do i link with only one of the libraries? how do i link to libcp/libcpmt. shouldn't the compiler do that automatically, as the are default libraries, and i am NOT ignoring default libraries?
    <font color="blue">System Specs</font>
    Dual Boot:
    1. Gentoo Linux
    2. Win2k
    Athlon XP Barton 2700
    512 MB PC 2700 DDR Ram
    GF4 Ti4200 AGP 8X 64 MB
    Onboard Sound

  7. #7
    ????????????????????????? Doomulation's Avatar
    Join Date
    Nov 2001
    Location
    ????????????????
    Posts
    8,776
    Mentioned
    0 Post(s)
    Well if you're not ignoring the standard libraries, then how the hell can't it find iostreams? You tell us =)
    I've noticed similar problems, though... it probably is that the libraries you're linking against both have some symbols (same). Maybe you can throw one of those libraries away and it will still work. Worth a try.
    Atashi wa juu-yon-sai no onna no ko! Atashi no namae wa Miizuki. Yurushiku ne!
    Nani? Atashi o shinjirimasen desu ka? Baka!
    "You're all doomed! Doomed, I say! Hehe... are we approaching the end of the world?"

    shikata ga kaite aru - "the instructions are written above"
    Need to download GoodN64 or instructions to use it? Need to check if it's a good or bad rom?
    Download: Glide64 | Hacktarux's wrapper

  8. #8
    What's that...? mesman00's Avatar
    Join Date
    Nov 2001
    Location
    USA
    Posts
    1,425
    Mentioned
    0 Post(s)
    Quote Originally Posted by Doomulation
    Well if you're not ignoring the standard libraries, then how the hell can't it find iostreams? You tell us =)
    I've noticed similar problems, though... it probably is that the libraries you're linking against both have some symbols (same). Maybe you can throw one of those libraries away and it will still work. Worth a try.
    that is a result of ignoring the msvcrtd lib, i think. if i ingore this lib i reduce the amount of erros, but other problems are created. see above. to me it appears that two libraries define the same method/struct or something, thus causing a conflict.
    <font color="blue">System Specs</font>
    Dual Boot:
    1. Gentoo Linux
    2. Win2k
    Athlon XP Barton 2700
    512 MB PC 2700 DDR Ram
    GF4 Ti4200 AGP 8X 64 MB
    Onboard Sound

Similar Threads

  1. Chanka Compatability List
    By Stezo2k in forum Chankast
    Replies: 923
    Last Post: March 4th, 2009, 20:17
  2. MarioParty3 Errors
    By MrRCS in forum Project64
    Replies: 1
    Last Post: July 14th, 2003, 18:34
  3. Argh GCC errors <warning LONG>
    By Cyberman in forum Programming
    Replies: 4
    Last Post: May 23rd, 2003, 15:52
  4. Replies: 7
    Last Post: December 14th, 2001, 06:00

Posting Permissions

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