views:

278

answers:

2

I'm converting a project from vs2008 to vs2010 and getting linker errors for std:ifstream/ofstream

error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::is_open(void)const " (__imp_?is_open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QBE_NXZ)

Building static (/MT) or dll (/MD) with unicode or standard and release/debug gives the same error. Manually adding libcpmtd.lib (static) or msvcprtd.lib (dll) to the linker doesn't help.

Has anyone else seen this?

+1  A: 

If you don't get an answer for this particular problem, there is a brute force approach that I've used with great success:

Using Visual Studio 2010, create a new project of the same type in a temporary folder somewhere (use the same project and solution name), and make sure you use the same options as your VS2008 project.

At this point, you may simply be able to compare the new VS2010 project file against your existing VS2008 project's file using a visual diff tool (I like BeyondCompare). The project files are XML, so it's fairly easy to visually compare them. From this comparison, I can usually tell what libraries and other options need to change.

If the older project file has too many changes (making the comparison difficult), repeat the above steps (using VS2008 this time) to create another plain-jane project, writing it to a different temporary location.

Now you should be able to compare the VS2008 and VS2010 boilerplate project files to see what comple and link settings are different.

Scott Smith
Thanks was hoping to avoid that - it's a complex project
Martin Beckett
A: 

Is this a managed application?