473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

C4251 warning message

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
2 4822
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Robert A Riedel | last post by:
I have a class that is intended to be exported in a DLL that uses another class that is in a static library. All clients that use the DLL will also link with the same static library. In summary,...
7
by: Alfonso Morra | last post by:
I cannot believe how convoluted it is to export function templates and class templates from a shared library (or DLL as it is called in the Windoze world). Micro$oft support for STL and...
2
by: Siemel Naran | last post by:
I keep getting warning messages like these: ....\include\myfile.h(451) : warning C4251: 'MyClass::m_myvariable' : class 'CPtrArray' needs to have dll-interface to be used by clients of class...
0
by: Bart Simpson | last post by:
I am writing a shared object (Dll in Windows) and I am making extensive use of the STL. I am getting lots of warnings like this: ClassA.h(139): warning C4251: 'ClassA::indexarray' : class...
6
by: Bart Simpson | last post by:
I am writing a shared object (Dll in Windows) and I am making extensive use of the STL. I am getting lots of warnings like this: ClassA.h(139): warning C4251: 'ClassA::indexarray' : class...
13
by: Anonymous | last post by:
On MS site: http://msdn2.microsoft.com/en-us/library/esew7y1w(VS.80).aspx is the following garbled rambling: "You can avoid exporting classes by defining a DLL that defines a class with...
6
by: =?Utf-8?B?RmFiaWFu?= | last post by:
Hello, I have a class hierarchy distributed over 3 native C++ dlls. The base class has a .NET Windows.Form for status output via a gcroot<>. The gcroot is declared private - the sub classes only...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.