C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

STL : probleme de preprocesseur

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
Jeremie Fouche
Guest





PostPosted: Sun Aug 08, 2004 11:26 am    Post subject: STL : probleme de preprocesseur Reply with quote



Bonjour a tous

Je suis confronté au probleme suivant :
J'utilise la STL dans une une interface graphique sous Windows ( wxWindow et
Dev-C++ ).
J'utilise la classe xwDC qui a pour fonction membre DrawText. Cette fonction
est aussi une méthode "C" de l'API Windows.
lorsque j'écris :

#include <vector>
....
wxDC dc;
dc.DrawText(...);

le preprocesseur modifie cette syntaxe en :
dc.DrawTextA(...) ou dc.DrawTextW(...) en fonction de la directive UNICODE
dans le fichier "windef.h".

windef.h :

#ifdef UNICODE
#define DrawText DrawTextW
#else // UNICODE
#define DrawText DrawTextA
#endif

Le probleme vient du fait que le fichier "windef.h" est inclus
(indirectement) par <vector>, et plus particulierement par <ghtr-default.h>.
Comment resoudre mon probleme ?
Merci

--
Jérémie

Back to top
Nico
Guest





PostPosted: Sun Aug 08, 2004 11:53 am    Post subject: Re: probleme de preprocesseur Reply with quote



Une méthode pas très jolie :

Un .cpp avec une méthode DCDrawText() qui prend en paramètre un wxDC& et les
autres paramètres de DrawText().


"Jeremie Fouche" <jeremie.fouche.tonmasque (AT) tiscali (DOT) fr> a écrit dans le
message de news:cf52v8$bhm$1 (AT) news (DOT) tiscali.fr...
Quote:
Bonjour a tous

Je suis confronté au probleme suivant :
J'utilise la STL dans une une interface graphique sous Windows ( wxWindow
et
Dev-C++ ).
J'utilise la classe xwDC qui a pour fonction membre DrawText. Cette
fonction
est aussi une méthode "C" de l'API Windows.
lorsque j'écris :

#include <vector
...
wxDC dc;
dc.DrawText(...);

le preprocesseur modifie cette syntaxe en :
dc.DrawTextA(...) ou dc.DrawTextW(...) en fonction de la directive UNICODE
dans le fichier "windef.h".

windef.h :

#ifdef UNICODE
#define DrawText DrawTextW
#else // UNICODE
#define DrawText DrawTextA
#endif

Le probleme vient du fait que le fichier "windef.h" est inclus
(indirectement) par ghtr-default.h>.
Comment resoudre mon probleme ?
Merci

--
Jérémie




Back to top
Loïc Joly
Guest





PostPosted: Sun Aug 08, 2004 12:29 pm    Post subject: Re: STL : probleme de preprocesseur Reply with quote



Jeremie Fouche wrote:

[...]

Quote:
windef.h :

#ifdef UNICODE
#define DrawText DrawTextW
#else // UNICODE
#define DrawText DrawTextA
#endif

Le probleme vient du fait que le fichier "windef.h" est inclus
(indirectement) par <vector>, et plus particulierement par <ghtr-default.h>.
Comment resoudre mon probleme ?
Merci

Peut-être ajouter #undef DrawText après tes include ?

--
Loïc

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.