PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.c > ow to prevent macro expansion in C/C++?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
ow to prevent macro expansion in C/C++?

Réponse
 
LinkBack Outils de la discussion
Vieux 12/04/2008, 21h52   #1
3mwn8tbfrd19ph0@mail.htl22.at
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut ow to prevent macro expansion in C/C++?

I am writing codes in windows and Unicode. The windows header file
defines CreateFont into CreateFontW. I am using a class which has a
function CreateFile. So when compiling, I got error that the
CreateFontW is not a member of the class.

What should I do?

Thanks for your !
  Réponse avec citation
Vieux 12/04/2008, 22h16   #2
jacob navia
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ow to prevent macro expansion in C/C++?

3mwn8tbfrd19ph0@mail.htl22.at wrote:
> I am writing codes in windows and Unicode. The windows header file
> defines CreateFont into CreateFontW. I am using a class which has a
> function CreateFile. So when compiling, I got error that the
> CreateFontW is not a member of the class.
>
> What should I do?
>
> Thanks for your !


#undef CreateFont

and you are all set
  Réponse avec citation
Vieux 12/04/2008, 22h18   #3
Gordon Burditt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ow to prevent macro expansion in C/C++?

>I am writing codes in windows and Unicode. The windows header file
>defines CreateFont into CreateFontW. I am using a class which has a


C does not have classes.

>function CreateFile. So when compiling, I got error that the
>CreateFontW is not a member of the class.


Huh? How did Create*File* get turned into Create*Font*W?
I think there are either typos in your post or something else
going on you haven't mentioned.

>What should I do?


Can you rename the member functions of your class?

It looks like you can't include the Windows header file and the
class header file in the same compilation. Can you split the code
into separate files?

One of the reason ANSI C has "namespace pollution" rules on ANSI C
header files is to avoid this sort of thing. It doesn't have any
jurisdiction over OS headers, though.


  Réponse avec citation
Vieux 12/04/2008, 22h40   #4
Flash Gordon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ow to prevent macro expansion in C/C++?

3mwn8tbfrd19ph0@mail.htl22.at wrote, On 12/04/08 21:52:
> I am writing codes in windows and Unicode. The windows header file
> defines CreateFont into CreateFontW. I am using a class which has a
> function CreateFile. So when compiling, I got error that the
> CreateFontW is not a member of the class.
>
> What should I do?


You should learn that C and C++ are different languages which is why
there is also a group comp.lang.c++. C does not have classes, so if you
are getting errors about something not being a member of a class you are
almost certainly not using C.

Also, I strongly suspect that the things you are talking about are
Windows specific (I happen to know that Windows has a CreateFile
function) so you actually need to ask in a Windows group where you will
find a lot more Windows experts.
--
Flash Gordon
  Réponse avec citation
Vieux 13/04/2008, 00h34   #5
CBFalconer
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ow to prevent macro expansion in C/C++?

Flash Gordon wrote:
> 3mwn8tbfrd19ph0@mail.htl22.at wrote:
>
>> I am writing codes in windows and Unicode. The windows header
>> file defines CreateFont into CreateFontW. I am using a class
>> which has a function CreateFile. So when compiling, I got error
>> that the CreateFontW is not a member of the class.
>>
>> What should I do?

>
> You should learn that C and C++ are different languages which is
> why there is also a group comp.lang.c++. C does not have classes,
> so if you are getting errors about something not being a member
> of a class you are almost certainly not using C.
>
> Also, I strongly suspect that the things you are talking about
> are Windows specific (I happen to know that Windows has a
> CreateFile function) so you actually need to ask in a Windows
> group where you will find a lot more Windows experts.


In fact, CreateFont and CreateFontW do not exist in the standard C
language, and thus are entirely off-topic in this newsgroup. If
you are willing to put up with the non-standard Windows system, you
should ask your questions in a Windows newsgroup.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

** Posted from http://www.teranews.com **
  Réponse avec citation
Vieux 13/04/2008, 09h11   #6
Flash Gordon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ow to prevent macro expansion in C/C++?

CBFalconer wrote, On 13/04/08 00:34:
> Flash Gordon wrote:
>> 3mwn8tbfrd19ph0@mail.htl22.at wrote:
>>
>>> I am writing codes in windows and Unicode. The windows header
>>> file defines CreateFont into CreateFontW. I am using a class
>>> which has a function CreateFile. So when compiling, I got error
>>> that the CreateFontW is not a member of the class.
>>>
>>> What should I do?

>> You should learn that C and C++ are different languages which is
>> why there is also a group comp.lang.c++. C does not have classes,
>> so if you are getting errors about something not being a member
>> of a class you are almost certainly not using C.
>>
>> Also, I strongly suspect that the things you are talking about
>> are Windows specific (I happen to know that Windows has a
>> CreateFile function) so you actually need to ask in a Windows
>> group where you will find a lot more Windows experts.

>
> In fact, CreateFont and CreateFontW do not exist in the standard C
> language, and thus are entirely off-topic in this newsgroup. If
> you are willing to put up with the non-standard Windows system, you
> should ask your questions in a Windows newsgroup.


Why bother posting to restate that the poster should go to a Windows
group when I had already said that? Also C (of any variety) is
irrelevant to the OPs problem as you will find if you re-read the above
since the OP is using C++.
--
Flash Gordon
  Réponse avec citation
Vieux 13/04/2008, 12h19   #7
Richard
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ow to prevent macro expansion in C/C++?

Flash Gordon <spam@flash-gordon.me.uk> writes:

> CBFalconer wrote, On 13/04/08 00:34:
>> Flash Gordon wrote:
>>> 3mwn8tbfrd19ph0@mail.htl22.at wrote:
>>>
>>>> I am writing codes in windows and Unicode. The windows header
>>>> file defines CreateFont into CreateFontW. I am using a class
>>>> which has a function CreateFile. So when compiling, I got error
>>>> that the CreateFontW is not a member of the class.
>>>>
>>>> What should I do?
>>> You should learn that C and C++ are different languages which is
>>> why there is also a group comp.lang.c++. C does not have classes,
>>> so if you are getting errors about something not being a member
>>> of a class you are almost certainly not using C.
>>>
>>> Also, I strongly suspect that the things you are talking about
>>> are Windows specific (I happen to know that Windows has a
>>> CreateFile function) so you actually need to ask in a Windows
>>> group where you will find a lot more Windows experts.

>>
>> In fact, CreateFont and CreateFontW do not exist in the standard C
>> language, and thus are entirely off-topic in this newsgroup. If
>> you are willing to put up with the non-standard Windows system, you
>> should ask your questions in a Windows newsgroup.

>
> Why bother posting to restate that the poster should go to a Windows
> group when I had already said that? Also C (of any variety) is


It has never stopped you "Flash" - I counted 8 "OT" replies once where
you were about #5. I remember chuckling at how pleased you must all have
been to get a chance to bully another newcomer to the group.

Another case of the one rule for some and other rules for others? I had
no idea that Chuck was so far gone from the clique.

> irrelevant to the OPs problem as you will find if you re-read the
> above since the OP is using C++.


Chuck is scraping the bottom of the barrel to find things he is
qualified to reply to without making a mistake.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h08.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16039 seconds with 15 queries