the Demo can not compile,why?

sssa2000
Posts: 12
Joined: Thu Oct 26, 2006 8:36 am

the Demo can not compile,why?

Post by sssa2000 »

the demo:
Extras/test_BulletOde.cpp

i create a project, and include the ode's lib and bullet's lib
but complier report:

odewithbullet error LNK2005: "protected: void __thiscall std::ios_base::_Init(void)" (?_Init@ios_base@std@@IAEXXZ) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet error LNK2005: "public: __thiscall std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet error LNK2005: "public: __thiscall std::_Locinfo::~_Locinfo(void)" (??1_Locinfo@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet error LNK2005: "public: __thiscall std::locale::locale(void)" (??0locale@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet error LNK2005: "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet error LNK2005: "public: virtual __thiscall std::ios_base::~ios_base(void)" (??1ios_base@std@@UAE@XZ) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet error LNK2005: "public: void __thiscall std::ios_base::_Addstd(void)" (?_Addstd@ios_base@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet error LNK2005: "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet error LNK2005: "public: void __thiscall std::locale::facet::_Register(void)" (?_Register@facet@locale@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP71D.dll)
odewithbullet 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(MSVCP71D.dll)
odewithbullet 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(MSVCP71D.dll)
odewithbullet error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)
odewithbullet error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)
odewithbullet error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)
odewithbullet error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)
odewithbullet error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR71D.dll)
odewithbullet error LNK2005: __c_exit already defined in MSVCRTD.lib(MSVCR71D.dll)
odewithbullet error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR71D.dll)
odewithbullet error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR71D.dll)
odewithbullet error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR71D.dll)
odewithbullet error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR71D.dll)
odewithbullet error LNK2005: _fflush already defined in MSVCRTD.lib(MSVCR71D.dll)
odewithbullet error LNK2005: _free already defined in MSVCRTD.lib(MSVCR71D.dll)
odewithbullet error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj)
odewithbullet error LNK2005: _malloc already defined in MSVCRTD.lib(MSVCR71D.dll)
odewithbullet error LNK2005: _realloc already defined in MSVCRTD.lib(MSVCR71D.dll)
odewithbullet fatal error LNK1169: one or more multiply defined symbols found


why?
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

You must link the CRT library dynamically
sssa2000
Posts: 12
Joined: Thu Oct 26, 2006 8:36 am

sorry, can you tell me how can i do it?

Post by sssa2000 »

sorry, can you tell me how can i do it?
thanks!
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

You need to make sure that the libraries you want to use both link to C Runtime (CRT) DLL instead to the static LIB. I don't know if these are available precompiled. You can easily build these libraries yourself:

1) Open the Solution
2) Right - click onto each project -> choose "Properties"
3) In the new window open Configuration Properties -> C/C++ -> Code Generation
4) Then in the right hand side window (in the middle) swith the entry "Runtime Library" to "Multithreaded DLL"
sssa2000
Posts: 12
Joined: Thu Oct 26, 2006 8:36 am

i have try it,but ...

Post by sssa2000 »

i have try it,but it not slove the problem.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

Did you build both libraries with these settings and your own application?