0
Visual Studio 2005 C++ 코드를 Visual Studio 2010으로 마이그레이션합니다. 불행히도 VS2005에서는 std :: string에 오류가 발생하지만 VS2005에서는이 오류가 발생하지 않았습니다. 여기 std :: string은 Visual Studio 2010에서 컴파일러 경고를 표시합니다.
는 코드 예제와 같이#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
};
컴파일러 경고 :
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>
]
나에게이 문제에 대한 솔루션을 제공하기 위해 도와주세요.
http://stackoverflow.com/questions/5661738/common-practice-in-dealing-with-warning-c4251-class-needs-to-have-dll-inter – Arun
PIMPL 관용구를 사용 가능한 해결책이 here -http : //stackoverflow.com/questions/767579/exporting-classes-containing-std-objects-vector-map-etc-from-a-dll – Arun