CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2012
    Posts
    3

    UnitTest++ LNK2005 ERROR

    ------ Build started: Project: MatchServer, Configuration: BRZ_Release_publish Win32 ------

    Linking...
    UnitTest++.vsnet2003.lib(Test.obj) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in libcpmt.lib(xlock.obj)
    UnitTest++.vsnet2003.lib(Test.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmt.lib(xlock.obj)
    UnitTest++.vsnet2003.lib(Test.obj) : error LNK2005: "public: void __thiscall std::_Mutex::_Lock(void)" (?_Lock@_Mutex@std@@QAEXXZ) already defined in libcpmt.lib(xmutex.obj)
    UnitTest++.vsnet2003.lib(Test.obj) : error LNK2005: "public: void __thiscall std::_Mutex::_Unlock(void)" (?_Unlock@_Mutex@std@@QAEXXZ) already defined in libcpmt.lib(xmutex.obj)
    cryptlib2003.lib(algparam.obj) : warning LNK4218: non-native module found; restarting link with /LTCG
    UnitTest++.vsnet2003.lib(Test.obj) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in libcpmt.lib(xlock.obj)
    UnitTest++.vsnet2003.lib(Test.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmt.lib(xlock.obj)
    UnitTest++.vsnet2003.lib(Test.obj) : error LNK2005: "public: void __thiscall std::_Mutex::_Lock(void)" (?_Lock@_Mutex@std@@QAEXXZ) already defined in libcpmt.lib(xmutex.obj)
    UnitTest++.vsnet2003.lib(Test.obj) : error LNK2005: "public: void __thiscall std::_Mutex::_Unlock(void)" (?_Unlock@_Mutex@std@@QAEXXZ) already defined in libcpmt.lib(xmutex.obj)
    libcp.lib(stdhndlr.obj) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in libcpmt.lib(xlock.obj)
    libcp.lib(stdhndlr.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmt.lib(xlock.obj)
    Runtime/MatchServer.exe : fatal error LNK1169: one or more multiply defined symbols found

    Build log was saved at "file://c:\Documents and Settings\Administrator\Desktop\Source 07-2012\Stable\MatchServer\BRZ_Release_publish\BuildLog.htm"
    MatchServer - 11 error(s), 1 warning(s)


    ---------------------- Done ----------------------

    Build: 6 succeeded, 1 failed, 0 skipped

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: UnitTest++ LNK2005 ERROR

    Seems like your UnitTest lib is already linked with MSVC runtime. Try linking with 'Ignore All Default Libraries' set as Yes.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  3. #3
    Join Date
    Jul 2012
    Posts
    3

    Re: UnitTest++ LNK2005 ERROR

    How would i do that?

  4. #4
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: UnitTest++ LNK2005 ERROR

    1. Press "Alt + F7" or follow the menu options Project -> Properties
    2. Click "Configuration Properties" and go to "Linker"
    3. In the further options, select "Input"
    4. At the right side (in the properties window), you'll find "Ignore All Default Libraries"

  5. #5
    Join Date
    Jul 2012
    Posts
    3

    Re: UnitTest++ LNK2005 ERROR

    Tried it but it gives me 700 more errors.. what now?

  6. #6
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: UnitTest++ LNK2005 ERROR

    Quote Originally Posted by daemontje View Post
    Tried it but it gives me 700 more errors.. what now?
    With this comprehensive description, I can only offer LNK2005.

  7. #7
    Join Date
    Apr 2012
    Posts
    29

    Re: UnitTest++ LNK2005 ERROR

    Quote Originally Posted by daemontje View Post
    Tried it but it gives me 700 more errors.. what now?
    700 is reasonable and sure OK, please re-post with a better clarification

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured