I am migrating my Visual Studio 2005 C++ code to Visual Studio 2010. Unfortunately I am getting error on std::string on VS2010 whereas in VS2005 I never had this error before.
Here is the code sample
#include<string>
typedef std::string String
class __declspec(dllexport) SomeClass
{
public:
String somevariable; // compiler warning here. Please see below for the compiler warning.
void SomeFunction(String sName); // No compiler errors or warning here
};
Compiler warning as:
error C2220: warning treated as error - no 'object' file generated
warning C4251: 'SomeClass::somevariable' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'SomeClass'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]
Please help to give me solution for this issue.