Results 1 to 6 of 6

Thread: Linking problems with multiply defined symbols

  1. #1
    Join Date
    Feb 2007
    Posts
    31
    Thanks
    11

    Default Linking problems with multiply defined symbols

    Hi,

    I'm using Qt 4.2.2 on an XP box and using nmake (C:\Program Files\Microsoft Visual Studio 8\VC\bin\nmake.exe).

    I'm working on a legacy app that used STL strings and I'm getting multiply defined symbols linker errors because std::basic_string is defined in qtmain.lib and in msvcprt.lib.

    Has anyone else come across this problem?

    Thank you for your time.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Linking problems with multiply defined symbols

    Can we see the errors?

  3. The following user says thank you to wysota for this useful post:

    JimBrown (2nd March 2007)

  4. #3
    Join Date
    Feb 2007
    Posts
    31
    Thanks
    11

    Default Re: Linking problems with multiply defined symbols

    Quote Originally Posted by wysota View Post
    Can we see the errors?
    Sure!

    qtmain.lib(qtmain_win.obj) : error LNK2005: "class std::basic_string<char,struct
    std::char_traits<char>,class std::allocator<char> > __cdecl std:perator+<char
    ,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_str
    ing<char,struct std::char_traits<char>,class std::allocator<char> > const &,clas
    s std::basic_string<char,struct std::char_traits<char>,class std::allocator<char
    > > const &)" (??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std @@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$al locator@D@2@@0@ABV10@0@Z) already defined in msvcprt.lib(MSVCP80.dll)

    qtmain.lib(qtmain_win.obj) : error LNK2005: "class std::basic_string<char,struct
    std::char_traits<char>,class std::allocator<char> > __cdecl std:perator+<char
    ,struct std::char_traits<char>,class std::allocator<char> >(char const *,class s
    td::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >
    const &)" (??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std @@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$al locator@D@2@@0@PBDABV10@@Z) already defined in msvcprt.lib(MSVCP80.dll)

    qtmain.lib(qtmain_win.obj) : error LNK2005: "class std::basic_string<char,struct
    std::char_traits<char>,class std::allocator<char> > __cdecl std:perator+<char
    ,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_str
    ing<char,struct std::char_traits<char>,class std::allocator<char> > const &,char
    const *)" (??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std @@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$al locator@D@2@@0@ABV10@PBD@Z) already defined in msvcprt.lib(MSVCP80.dll)

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking problems with multiply defined symbols

    Have you built Qt 4.2.2 yourself?

  6. The following user says thank you to jacek for this useful post:

    JimBrown (2nd March 2007)

  7. #5
    Join Date
    Feb 2007
    Posts
    31
    Thanks
    11

    Default Re: Linking problems with multiply defined symbols

    Quote Originally Posted by jacek View Post
    Have you built Qt 4.2.2 yourself?
    No. I am using it right out of the box.

  8. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking problems with multiply defined symbols

    Quote Originally Posted by JimBrown View Post
    No. I am using it right out of the box.
    That might be the problem. Since you use the commercial version, you could ask the Trolltech support whether they know any better solution, but I would simply try to recompile Qt to make sure that it's compatible with your toolchain.

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Replies: 3
    Last Post: 30th January 2006, 15:13
  3. Replies: 25
    Last Post: 15th January 2006, 00:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.