I recently created an old C ++ library in Visual Studio 2008. In this project, I used some class methods std::string. Now I want to use this library in a Visual Studio 2013 project.
The problem is this:
Both versions of Visual Studio use different platform tools, and the project will not compile due to linker errors, such as:
Error 4 LNK2001 errors: unresolved external character "__declspec (dllimport) public: __thiscall std :: basic_string, class std :: allocator> :: basic_string, class std :: allocator> (void)" (__imp _ ?? 0? $ Basic_string @DU? $ Char_traits @D @ stand @@ V? $ Distributor @D @ 2 @@ stand @@ QAE @XZ)
Is there a way to make the library compatible with all platform tools and use some standard classes, for example std::string?
FYI: VS2008 uses the v90 platform toolkit, and VS2013 uses the v120 platform toolkit.
Thank.
Edit:
If I use some standard methods in the library, for example std::vector, I can no longer implement the library.
It works:
unsigned int TestClass::TestMethod()
{
return 2;
}
It does not mean:
unsigned int TestClass::TestMethod()
{
std::vector<unsigned char> vtest;
vtest.push_back(0xff);
return 2;
}
Error:
1 LNK2019: "public: static void __cdecl std:: _ String_base:: _ Xran (void)" (? _Xran @_String_base @std @@SAXXZ), "public: class :: basic_string, std:: allocator > __thiscall std:: basic_string, class std:: allocator > :: assign ( :: basic_string, std:: allocator > const &, unsigned int, unsigned int)" (? @? $Basic_string @DU? $Char_traits @D @ @@V? $ @D @2 @@ @@QAEAAV12 @ABV12 @II @Z)
RT lib /MT, whloe (/GL).
?
.