Git Product home page Git Product logo

Comments (5)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 8, 2024
I'm using VS2005. This solution doesn't work for me. After changing to /MD and 
/MDd, 
got many other linking errors (from gtest color example):

Error   1   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 
msvcprtd.lib(MSVCP80D.dll)  libcpmtd.lib    
Error   2   error LNK2005: "public: static void __cdecl 
std::ios_base::_Addstd(class std::ios_base *)" 
(?_Addstd@ios_base@std@@SAXPAV12@@Z) 
already defined in msvcprtd.lib(MSVCP80D.dll)   libcpmtd.lib    
Error   3   error LNK2005: "private: static class std::locale::_Locimp * __cdecl 
std::locale::_Getgloballocale(void)" (?
_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ) already defined in 
msvcprtd.lib(MSVCP80D.dll)  libcpmtd.lib    
Error   4   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(MSVCP80D.dll)  libcpmtd.lib    
Error   5   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 
msvcprtd.lib(MSVCP80D.dll)  libcpmtd.lib    
Error   6   error LNK2005: "public: static void __cdecl 
std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,char const *)" (?
_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z) already defined in 
msvcprtd.lib(MSVCP80D.dll)  libcpmtd.lib    
Error   7   error LNK2005: "public: static void __cdecl 
std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?
_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z) already defined in 
msvcprtd.lib(MSVCP80D.dll)  libcpmtd.lib    
Error   8   error LNK2005: "void * __cdecl operator new(unsigned int,struct 
std::_DebugHeapTag_t const &,char *,int)" 
(??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) 
already defined in msvcprtd.lib(MSVCP80D.dll)   libcpmtd.lib    
Error   9   error LNK2005: "void * __cdecl operator new[](unsigned int,struct 
std::_DebugHeapTag_t const &,char *,int)" 
(??_U@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) 
already defined in msvcprtd.lib(MSVCP80D.dll)   libcpmtd.lib    
Error   10  error LNK2005: "struct std::_DebugHeapTag_t const & __cdecl 
std::_DebugHeapTag_func(void)" 
(?_DebugHeapTag_func@std@@YAABU_DebugHeapTag_t@1@XZ) 
already defined in msvcprtd.lib(MSVCP80D.dll)   libcpmtd.lib    
Error   11  error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??
0_Lockit@std@@QAE@H@Z) already defined in 
msvcprtd.lib(MSVCP80D.dll)  libcpmtd.lib    
Error   12  error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??
1_Lockit@std@@QAE@XZ) already defined in 
msvcprtd.lib(MSVCP80D.dll)  libcpmtd.lib    
Error   13  error LNK2005: __configthreadlocale already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   14  error LNK2005: _free already defined in MSVCRTD.lib(MSVCR80D.dll)   
LIBCMTD.lib 
Error   15  error LNK2005: __CrtSetCheckCount already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   16  error LNK2005: "public: __thiscall std::exception::exception(void)" 
(??0exception@std@@QAE@XZ) already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   17  error LNK2005: "public: __thiscall std::exception::exception(char 
const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   18  error LNK2005: "public: __thiscall std::exception::exception(class 
std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   19  error LNK2005: "public: virtual __thiscall 
std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   20  error LNK2005: "public: virtual char const * __thiscall 
std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) already 
defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   21  error LNK2005: "public: __thiscall std::bad_cast::bad_cast(char const 
*)" (??0bad_cast@std@@QAE@PBD@Z) already defined in MSVCRTD.lib(MSVCR80D.dll)   
LIBCMTD.lib 
Error   22  error LNK2005: "public: __thiscall std::bad_cast::bad_cast(class 
std::bad_cast const &)" (??0bad_cast@std@@QAE@ABV01@@Z) already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   23  error LNK2005: "public: virtual __thiscall 
std::bad_cast::~bad_cast(void)" (??1bad_cast@std@@UAE@XZ) already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   24  error LNK2005: _localeconv already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   25  error LNK2005: __encode_pointer already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   26  error LNK2005: __decode_pointer already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   27  error LNK2005: __crt_debugger_hook already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   28  error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR80D.dll)   
LIBCMTD.lib 
Error   29  error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR80D.dll)  
LIBCMTD.lib 
Error   30  error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR80D.dll) 
LIBCMTD.lib 
Error   31  error LNK2005: __amsg_exit already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   32  error LNK2005: __initterm_e already defined in 
MSVCRTD.lib(MSVCR80D.dll)   LIBCMTD.lib 
Error   33  error LNK2005: __stricmp already defined in MSVCRTD.lib(MSVCR80D.dll)   
LIBCMTD.lib 

..................................
..................................

Original comment by [email protected] on 10 Sep 2008 at 4:19

from googletest.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 8, 2024
I think this is fixed in the svn head.  Please wait for the next release of 
gtest or
check out the svn head revision directly.

Original comment by [email protected] on 10 Sep 2008 at 6:18

  • Changed state: Fixed

from googletest.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 8, 2024
The issue is still there in the 1.6.0 version.

Steps to reproduce:
1. downloaded the googletest 1.6.0 version
2. converted the project to VS2008 and built it
3. build my test project with /MTd, linking to gtestd.lib and gtest_maind.lib
4. got errors:

Linking...
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall 
std::basic_stringstream<char,struct std::char_traits<char>,class 
std::allocator<char> >::basic_stringstream<char,struct 
std::char_traits<char>,class std::allocator<char> >(int)" 
(??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z) 
already defined in gtestd.lib(gtest-all.obj)
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall 
std::basic_stringstream<char,struct std::char_traits<char>,class 
std::allocator<char> >::`vbase destructor'(void)" 
(??_D?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ) 
already defined in gtestd.lib(gtest-all.obj)
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: char const * __thiscall 
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>::c_str(void)const " 
(?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) 
already defined in gtestd.lib(gtest-all.obj)
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall 
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>(void)" 
(??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) 
already defined in gtestd.lib(gtest-all.obj)
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::locale::facet * 
__thiscall std::locale::facet::_Decref(void)" 
(?_Decref@facet@locale@std@@QAEPAV123@XZ) already defined in 
gtestd.lib(gtest-all.obj)
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 
msvcprtd.lib(MSVCP90D.dll)
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 
msvcprtd.lib(MSVCP90D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "void __cdecl _AtModuleExit(void 
(__cdecl*)(void))" (?_AtModuleExit@@YAXP6AXXZ@Z) already defined in 
msvcprtd.lib(locale0_implib.obj)
libcpmtd.lib(locale0.obj) : error LNK2005: __Fac_tidy already defined in 
msvcprtd.lib(locale0_implib.obj)
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 
msvcprtd.lib(locale0_implib.obj)
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 
msvcprtd.lib(MSVCP90D.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(MSVCP90D.dll)
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 msvcprtd.lib(MSVCP90D.dll)
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 
msvcprtd.lib(MSVCP90D.dll)
libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall 
std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in 
msvcprtd.lib(MSVCP90D.dll)
libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall 
std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in 
msvcprtd.lib(MSVCP90D.dll)
LIBCMTD.lib(_file.obj) : error LNK2005: ___iob_func already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(lconv.obj) : error LNK2005: _localeconv already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined 
in MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(stricmp.obj) : error LNK2005: __stricmp already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" 
(?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf_s already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(strtol.obj) : error LNK2005: _strtol already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(strtoq.obj) : error LNK2005: __strtoui64 already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(vsnprnc.obj) : error LNK2005: __vsnprintf_s already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(printf.obj) : error LNK2005: _printf already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(vprintf.obj) : error LNK2005: _vprintf already defined in 
MSVCRTD.lib(MSVCR90D.dll)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; 
use /NODEFAULTLIB:library
C:\XXXX : fatal error LNK1169: one or more multiply defined symbols found

Error executing link.exe (tool returned code: 1169)

Original comment by [email protected] on 2 Aug 2011 at 7:54

from googletest.

syedbokhari avatar syedbokhari commented on May 8, 2024

Has this issue been resolved? I was facing exactly the same issue. I managed to resolve it by using exactly the same toolset for compiling my googletest and my test case project.

from googletest.

Dr-Steve avatar Dr-Steve commented on May 8, 2024

Just tried this using visual studio 2015 and the /MD(d) and an getting the same errors.

from googletest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.