468,719 Members | 1,778 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,719 developers. It's quick & easy.

LNK2005

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\Featur es.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::operator=(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?$alloc ator@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> >::operator+=(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"
(??Y?$basic_string@DU?$char_traits@D@std@@V?$alloc ator@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?$alloc ator@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?$alloc ator@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?$alloc ator@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> >::operator+=(char
const *)"
(??Y?$basic_string@DU?$char_traits@D@std@@V?$alloc ator@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> >::operator+=(char)"
(??Y?$basic_string@DU?$char_traits@D@std@@V?$alloc ator@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@@@st d@@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@@@st d@@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@@@st d@@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<char,struct std::char_traits<char>
::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?$a llocator@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<char,struct std::char_traits<char>::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@@Q BEDD@Z) bereits in
batchClassifier.obj definiert
msvcprt.lib(MSVCP71.dll) : error LNK2005: "bool __cdecl
std::operator==<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?$alloc ator@D@2@@std@@QAE@XZ)
bereits in batchClassifier.obj definiert
Thanks and regards,

Sebastian

May 29 '06 #1
2 2201
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
May 29 '06 #2
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:

Jun 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Florian Liefers | last post: by
reply views Thread by Mike Cheel | last post: by
reply views Thread by Taran | last post: by
9 posts views Thread by dewi | last post: by
1 post views Thread by CARIGAR | last post: by
9 posts views Thread by bryonone | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.