Visual Studio 2013을 사용하고 있는데 이상한 점이 있습니다. 클래스를 내 보내면 "삭제 된 함수를 참조하려고합니다."오류가 발생합니다. 그러나 클래스를 내 보내지 않으면 올바르게 작동합니다. 예상대로 다음의 모든 작품처럼 보이는 그래서 수출을 제거하면 클래스를 내보낼 때 컴파일러 오류가 발생했습니다.
지금 ... 나를 예를 들어 줄class Foo
{
};
// note the export
class __declspec(dllexport) Bar
{
// the following line throws the error
std::unordered_map<std::string, std::unique_ptr<Foo>> map;
};
을 보자.
class Foo
{
};
// note I removed the export
class Bar
{
// the following line now compiles without any issues
std::unordered_map<std::string, std::unique_ptr<Foo>> map;
};
이제 컴파일러 버그 또는 내가 분명히 누락 된 부분이 있습니까? 참고로, 위의 코드는 GCC 또는 Clang과 잘 작동합니다. DLL에서 클래스를 내보낼 때
Error 2 error C2280: 'std::unique_ptr<Foo,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)' : attempting to reference a deleted function c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 592
전체 오류 메시지처럼 보이지 않습니다. * complete * 및 * unedited * 오류 로그를 포함하도록 질문을 편집하십시오. –
이제 전체 오류를 붙여 넣었습니다. –