Convert solution from VS2003 to VS2008
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Convert solution from VS2003 to VS2008

  1. #1
    Join Date
    May 2010
    Posts
    24

    Question 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

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,634

    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.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  3. #3
    Join Date
    May 2010
    Posts
    24

    Exclamation 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?

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,634

    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?
    Last edited by S_M_A; May 17th, 2011 at 04:29 PM.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  5. #5
    Join Date
    Apr 2008
    Posts
    726

    Re: Convert solution from VS2003 to VS2008

    you're not using express 2008 are you?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center