By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 2,954 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

C4251 warning message

P: n/a
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'
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Nahappan SM wrote:
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

--
Anti-spam address, change each 'X' to '.' to reply directly.
Jul 23 '05 #2

P: n/a
Nahappan SM wrote:
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
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.