Error Link in VC++
-
Hello I create a MFC aplication, and in my cpp file, i define a variable C++ string str; I know that, i can use CString, but i want to know why it appears "error link" when i compile project, it appears error (error link) like that "Linking... msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::~basic_string,class std::allocator >(void)" (??1?$basic_strin g@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in ocl.lib(ora.obj) msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::basic_string,class std::allocator >(class basic_string,class std::allocator >::allocator const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$allocator@D@1@@Z) already defined in ocl.lib(ora.obj) LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library Bin/BMSOracleView.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. "
-
Hello I create a MFC aplication, and in my cpp file, i define a variable C++ string str; I know that, i can use CString, but i want to know why it appears "error link" when i compile project, it appears error (error link) like that "Linking... msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::~basic_string,class std::allocator >(void)" (??1?$basic_strin g@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in ocl.lib(ora.obj) msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::basic_string,class std::allocator >(class basic_string,class std::allocator >::allocator const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$allocator@D@1@@Z) already defined in ocl.lib(ora.obj) LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library Bin/BMSOracleView.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. "
coz "string" is STL string or std::string Bryce --- To paraphrase Fred Dagg - the views expressed in this post are bloody good ones. --
Publitor, making Pubmed easy. http://www.sohocode.com/publitorOur kids book :The Snot Goblin
-
Hello I create a MFC aplication, and in my cpp file, i define a variable C++ string str; I know that, i can use CString, but i want to know why it appears "error link" when i compile project, it appears error (error link) like that "Linking... msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::~basic_string,class std::allocator >(void)" (??1?$basic_strin g@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in ocl.lib(ora.obj) msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::basic_string,class std::allocator >(class basic_string,class std::allocator >::allocator const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$allocator@D@1@@Z) already defined in ocl.lib(ora.obj) LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library Bin/BMSOracleView.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. "
The
ocl.lib
is your or third-party library? Robert-Antonio "Friends come and leave, but teddybears stay in forever." -
The
ocl.lib
is your or third-party library? Robert-Antonio "Friends come and leave, but teddybears stay in forever." -
try inclding the lines at ur stdafx.h using namespace std; replace string with std::string and I hope u have not forgotten to include #include Dharani babu S redindian
I think that it isn't the case. If you forget the std namespace, you will get an Undeclared identifier error, not linker error. Robert-Antonio "What do you mean, I can't initialize things in an assert()?"