DLL exporting causing issues with unique pointers
问题 I've got two files: Header.h #pragma once #ifdef UNIQUEPTRISSUE_EXPORTS #define UNIQUEPTRISSUE_API __declspec(dllexport) #else #define UNIQUEPTRISSUE_API __declspec(dllimport) #endif UniquePtrIssue.cpp #include "stdafx.h" #include "Header.h" #include <memory> #include <vector> class UNIQUEPTRISSUE_API ClassA { }; class UNIQUEPTRISSUE_API ClassB { private: std::vector<std::unique_ptr<ClassA>> x; }; Compiling raises the following error: 1>d:\program files (x86)\microsoft visual studio\2017