It is not a good practice using stl-classes in the dll-interface as Common practice in dealing with warning c4251: class … needs to have dll-interface explains. An example i
OR do the easiest thing to do, move the __declspec
to the ONLY members you care to export:
class HelloWorld
{
public:
__declspec(dllexport) HelloWorld()
{
abc.resize(5);
for(int i=0; i<5; i++)
abc[i] = i*10;
str="hello the world";
}
__declspec(dllexport) ~HelloWorld()
{
}
std::vector abc;
std::string str;
};