LNK2005

B

bosse

Hi,

i have got a linker problem, i don't know how to handle; there are
three projects in my workspace. In the Project called modules_common is
a class called Features. In the second project there's a class called
FeaturesFromPng, which contains an instance of Features. The third
project contains the main-function in which i want to work with an
instance of FeaturesFromPng, but generating the instance produces a
LNK2005 error. If i delete the line which generates the instance of
Features in the class FeaturesFromPng, theres no linking problem, but
my code doesn't do what i want it to do.

Heres a part of the error-output with some verbose-information:
Durchsuchen von D:\Visual Studio
..NET\Vc7\PlatformSDK\lib\odbc32.lib:
Durchsuchen von D:\Visual Studio
..NET\Vc7\PlatformSDK\lib\odbccp32.lib:
Durchsuchen von
\user\bosse\dev\Adaptation\Features\Release\Features.lib:
Durchsuchen von \user\bosse\dev\Adaptation\release\Adaptation.lib:
Durchsuchen von D:\Visual Studio .NET\Vc7\lib\libcpmt.lib:
Durchsuchen von D:\Visual Studio .NET\Vc7\lib\LIBCMT.lib:
Durchsuchen von D:\Visual Studio .NET\Vc7\lib\OLDNAMES.lib:
Durchsuchen von D:\Visual Studio .NET\SDK\v1.1\lib\MSCOREE.LIB:
Durchsuchen von D:\Visual Studio .NET\Vc7\lib\msvcrt.lib:
msvcrt.lib(ti_inst.obj) : error LNK2005: "private: __thiscall
type_info::type_info(class type_info const &)"
(??0type_info@@AAE@ABV0@@Z) bereits in LIBCMT.lib(typinfo.obj)
definiert
msvcrt.lib(ti_inst.obj) : error LNK2005: "private: class type_info &
__thiscall type_info::blush:perator=(class type_info const &)"
(??4type_info@@AAEAAV0@ABV0@@Z) bereits in LIBCMT.lib(typinfo.obj)
definiert
msvcrt.lib(MSVCR71.dll) : error LNK2005: "public: __thiscall
bad_cast::bad_cast(char const *)" (??0bad_cast@@QAE@PBD@Z) bereits in
LIBCMT.lib(stdexcpt.obj) definiert
Durchsuchen von D:\Visual Studio .NET\Vc7\lib\msvcprt.lib:
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
std::_Mutex::_Unlock(void)" (?_Unlock@_Mutex@std@@QAEXXZ) bereits in
libcpmt.lib(xmutex.obj) definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
std::_Mutex::_Lock(void)" (?_Lock@_Mutex@std@@QAEXXZ) bereits in
libcpmt.lib(xmutex.obj) definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
std::locale::facet::_Register(void)"
(?_Register@facet@locale@std@@QAEXXZ) bereits in
libcpmt.lib(locale0.obj) definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
std::locale::facet::_Incref(void)" (?_Incref@facet@locale@std@@QAEXXZ)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: static unsigned int
__cdecl std::ctype<char>::_Getcat(class std::locale::facet const * *)"
(?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@@Z) bereits in
batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned
int)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z) bereits in
libcpmt.lib(locale0.obj) definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) bereits in
libcpmt.lib(xlock.obj) definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) bereits in
libcpmt.lib(xlock.obj) definiert
msvcprt.lib(MSVCP71.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)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::blush:perator+=(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"
(??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@@Z)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.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> >(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.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> >(char const *)"
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.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> >(unsigned int,char)"
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ID@Z)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::blush:perator+=(char
const *)"
(??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::blush:perator+=(char)"
(??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@D@Z)
bereits in configuration.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "bool __cdecl
std::uncaught_exception(void)" (?uncaught_exception@std@@YA_NXZ)
bereits in libcpmt.lib(uncaught.obj) definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: bool __thiscall
std::basic_istream<char,struct std::char_traits<char> >::_Ipfx(bool)"
(?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z) bereits
in configuration.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
std::basic_ostream<char,struct std::char_traits<char> > & __thiscall
std::basic_ostream<char,struct std::char_traits<char> >::flush(void)"
(?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)"
(?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ) bereits in
batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: void __thiscall
std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z)
bereits in libcpmt.lib(ios.obj) definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: int __thiscall
std::basic_streambuf said:
::snextc(void)" (?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ) bereits in configuration.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::append(unsigned
int,char)"
(?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ID@Z)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: int __thiscall
std::basic_streambuf<char,struct std::char_traits<char> >::sgetc(void)"
(?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ) bereits
in configuration.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: unsigned int
__thiscall std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::max_size(void)const "
(?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::erase(unsigned
int,unsigned int)"
(?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall
std::locale::~locale(void)" (??1locale@std@@QAE@XZ) bereits in
batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: class std::locale
__thiscall std::ios_base::getloc(void)const "
(?getloc@ios_base@std@@QBE?AVlocale@2@XZ) bereits in
batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: int __thiscall
std::basic_streambuf said:
::sbumpc(void)" (?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ) bereits in configuration.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: int __thiscall
std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)"
(?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z) bereits
in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: char __thiscall
std::basic_ios<char,struct std::char_traits<char> >::widen(char)const "
(?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDD@Z) bereits in
batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "bool __cdecl
std::blush:perator==<char,struct std::char_traits<char>,class
std::allocator<char> >(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &,char const
*)"
(??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z)
bereits in batchClassifier.obj definiert
msvcprt.lib(MSVCP71.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)"
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ)
bereits in batchClassifier.obj definiert


Thanks and regards,

Sebastian
 
M

Marcus Heege

Hi Bosse,

make sure that all projects you link together use the CRT in a consistent
way. Often, the best approach is to compile everything with /MD.

Marcus Heege
 
B

bosse

Hi Marcus,

thanks for your reply. I compiled everthing with /MD (before I compiled
with /MT), but I've got the same error-message.

Sebastian Bosse


Marcus Heege schrieb:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top