C4251 warning message

N

Nahappan SM

I have a struct :

#include <string>

struct __declspec (dllexport) FILEPROPERTIES
{
std::wstring FileName;
std::wstring Type;
};

I get the following warning during compilation. Any idea of how to resolve
this?

warning C4251: 'FileName' : class 'std::basic_string<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short> >'
needs to have dll-interface to be used by clients of struct 'FILEPROPERTIES'
 
L

Larry I Smith

Nahappan said:
I have a struct :

#include <string>

struct __declspec (dllexport) FILEPROPERTIES
{
std::wstring FileName;
std::wstring Type;
};

I get the following warning during compilation. Any idea of how to resolve
this?

warning C4251: 'FileName' : class 'std::basic_string<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short> >'
needs to have dll-interface to be used by clients of struct 'FILEPROPERTIES'

This is not a C++ language issue. The language knows
nothing about Windows DLL's. Try posting in a Windows
development newsgroup; you might get some answers there.

Larry
 
V

Victor Bazarov

Nahappan said:
I have a struct :

#include <string>

struct __declspec (dllexport) FILEPROPERTIES

"__declspec (dllexport)" is not C++. It's a Microsoft extension to the
language. As such it's OT here. Please visit microsoft.public.vc.*
family of newsgroups to consult about problems related to Microsoft VC++.
{
std::wstring FileName;
std::wstring Type;
};

I get the following warning during compilation. Any idea of how to resolve
this?

warning C4251: 'FileName' : class 'std::basic_string<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short> >'
needs to have dll-interface to be used by clients of struct 'FILEPROPERTIES'

The most probable reason for the warning is that the linkage specification
for the functions of 'std::wstring' and for your class are not the same,
but only in a Microsoft newsgroup you can learn for sure.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,813
Messages
2,569,699
Members
45,489
Latest member
SwethaJ

Latest Threads

Top