Convert solution from VS2003 to VS2008
Hi everyone,
I have a solution originally built in VS2003 several years ago. I need to use it now, but using VS2008. I've done the "convert projects" process, but I can't build the whole thing anymore. Here are the link errors I'm getting
Code:
1>Linking...
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __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 *)" (??$?HDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@ABV10@PBD@Z) already defined in Classifier.lib(Classifier.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z) already defined in Classifier.lib(Classifier.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z) already defined in AgeBat.obj
1>LINK : fatal error LNK1104: cannot open file 'mfc71.lib'
It seems to be searching for some libs from VS2003 (mfc71.lib). I don't know what to do to fix it. Can you help me?
thanks in advance
Re: Convert solution from VS2003 to VS2008
Seems like your original project was setup in a strange way. Either you create a new project, copy your source to that folder and add them to the new project (probably the easiest way) or you create a backup and then edit the vcproj-file(s) and remove all references to VS2003 files.
Also check that you haven't any other leftovers in the environment like INCLUDE, LIB and so on.
Re: Convert solution from VS2003 to VS2008
Hi S_M_A
Thanks for your answer.
I've tried to create a new project, but I still get these errors:
Code:
1>Linking...
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z) already defined in Classifier.lib(Classifier.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z) already defined in AgeBat.obj
1>LINK : fatal error LNK1104: cannot open file 'mfc71.lib'
I believe I've got less errors because I've just simplified the code a little.
The project uses a set of libs from projects also built in VS2003 - I've imported all of them (they are in the same solution) and it compiled without problems in 2008 (I only got several warnings due to 'unsafe' code). Should I re-create all of the projects (it will take some time, but if it works, that's fine)? Maybe, is there anything in the project properties I'm missing?
Re: Convert solution from VS2003 to VS2008
Yes, recreate all libs as well. You shouldn't mix things linked with different versions of the runtime.
For the moment you could do as the warnings say and define (probably) _CRT_SECURE_NO_WARNINGS and _CRT_NONSTDC_NO_WARNINGS (add them in project properties - C/C++ - Preprocessor - Preprocessor Definitions) to get rid of the unsafe code warnings in case they obscure more important warnings.
Edit: Oh! You still have that reference to mfc71.lib. It seems that you have some additional cleaning to do. Could it be that there's a #pragma comment( lib, "mfc71.lib" ) somewhere in the code?
Re: Convert solution from VS2003 to VS2008
you're not using express 2008 are you?