Click here to Skip to main content
15,912,977 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Compilation Error on map Pin
projyal27-May-03 22:05
projyal27-May-03 22:05 
GeneralRe: Compilation Error on map Pin
Joaquín M López Muñoz28-May-03 2:30
Joaquín M López Muñoz28-May-03 2:30 
Generaladd a DIALOGBAR Pin
aguest27-May-03 19:37
aguest27-May-03 19:37 
GeneralWTL: CFrameWindow question Pin
João Paulo Figueira27-May-03 1:28
professionalJoão Paulo Figueira27-May-03 1:28 
QuestionHow to Implement "Drag" in List View without using MFC Pin
Pious26-May-03 22:00
Pious26-May-03 22:00 
AnswerRe: How to Implement "Drag" in List View without using MFC Pin
AlexO27-May-03 6:30
AlexO27-May-03 6:30 
QuestionATL CString in C++ .net/2003 - to export or not? Pin
Peter Weyzen26-May-03 18:45
Peter Weyzen26-May-03 18:45 
AnswerRe: ATL CString in C++ .net/2003 - to export or not? Pin
27-May-03 7:35
suss27-May-03 7:35 
http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b134980

PRB: C4251 & C4275 Compiler Warnings While Compiling an AFXDLL
The information in this article applies to:
The Microsoft Foundation Classes (MFC), when used with:
Microsoft Visual C++, 32-bit Editions 2.0
Microsoft Visual C++, 32-bit Editions 2.1
Microsoft Visual C++, 32-bit Editions 2.2
This article was previously published under Q134980

SYMPTOMS
The Compiler issues the following warning for a class derived from one of the MFC classes:

warning C4275: non dll-interface class XXX used as base for dll-interface class YYY

A related warning is issued when an object of some MFC class is embedded as a data member of a user-defined class:

warning C4251: identifier : class XXX needs to have dll-interface to be used by clients of class YYY

This problem no longer occurs in vc 4.0 or later.

CAUSE
The DLL version of MFC does not export its classes by declaring them with "class __declspec(dllexport)." Instead, it exports its classes through entries in the EXPORTS section of its module definition (.def) file.

Because the compiler has only the header files to work with, it cannot determine whether the MFC classes were actually exported, and therefore it issues the warning.

RESOLUTION
Because the MFC classes are in fact exported, these warnings can be safely ignored. As shown in the DLLHUSK sample, you can disable these warnings by using the following pragma statements:
<br />
#pragma warning(disable: 4275)<br />
#pragma warning(disable: 4251)<br />


On the other hand, if the warnings refer to some user-defined class rather an MFC class, you should ensure that the class is exported before disabling these warnings.

STATUS
This behavior is by design.
GeneralWTL/STL Pin
bsanoop1726-May-03 7:30
bsanoop1726-May-03 7:30 
GeneralLong Atl Build-times Pin
Hugo Hallman25-May-03 11:07
Hugo Hallman25-May-03 11:07 
Generalerror C2065: 'ImageList_Read' : undeclared identifier Pin
szarea23-May-03 12:33
szarea23-May-03 12:33 
GeneralRe: error C2065: 'ImageList_Read' : undeclared identifier Pin
Tim Smith24-May-03 3:11
Tim Smith24-May-03 3:11 
GeneralVector Iterator Pin
ironhead23-May-03 4:10
ironhead23-May-03 4:10 
GeneralRe: Vector Iterator Pin
Joaquín M López Muñoz23-May-03 4:15
Joaquín M López Muñoz23-May-03 4:15 
GeneralRe: Vector Iterator Pin
ironhead23-May-03 13:40
ironhead23-May-03 13:40 
GeneralList view problem in Explorer like application Pin
Derick Cyril Thomas23-May-03 3:48
Derick Cyril Thomas23-May-03 3:48 
QuestionAbout Implement IDocHostUIHandler Interface funtion ShowContextMenu? Pin
Boyren20-May-03 4:49
Boyren20-May-03 4:49 
GeneralLooking for Good, Concise C++ Tutorials Pin
Kevin McFarlane20-May-03 1:30
Kevin McFarlane20-May-03 1:30 
GeneralRe: Looking for Good, Concise C++ Tutorials Pin
valikac20-May-03 8:52
valikac20-May-03 8:52 
GeneralRe: Looking for Good, Concise C++ Tutorials Pin
Kevin McFarlane20-May-03 11:38
Kevin McFarlane20-May-03 11:38 
GeneralRe: Looking for Good, Concise C++ Tutorials Pin
Joaquín M López Muñoz20-May-03 11:58
Joaquín M López Muñoz20-May-03 11:58 
GeneralVector &amp; structur Pin
aguest20-May-03 0:58
aguest20-May-03 0:58 
GeneralRe: Vector &amp; structur Pin
markkuk20-May-03 1:23
markkuk20-May-03 1:23 
GeneralRe: Vector &amp; structur Pin
aguest20-May-03 12:02
aguest20-May-03 12:02 
GeneralRe: Vector & structur Pin
markkuk20-May-03 12:31
markkuk20-May-03 12:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.