Re: dll export question / stl problem / C4251

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"scott mcfadden" <nospam.smcfadden@xxxxxxxxxxxxxxxx> wrote
in message news:Ox$Gwge1GHA.324@xxxxxxxxxxxxxxxxxxxxxxx
When I mark a class that uses STL strings for export in a
DLL project, VS 2003 gives me lots of warnings on my STL
string class members:

#include <string>
using namespace std

class __declspec(dllexport) MyClass{
public:
//default constructor
MyClass();

//destructor
~MyClass();

void DoIt();

string getSource();

bool setSource(string & source);

protected:

string m_source;
};

warning C4251: MyClass::source: class
'std::basic_string<_Elem,_Traits,_Ax>' needs to have
dll-interface to be used by clients of class MyClass

What causes these warnings? How can I avoid them?


Here's good in-depth explanation:

"VS.NET 2003 Warning C4251"
http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html


.



Relevant Pages