ow to prevent macro expansion in C/C++?

3

3mwn8tbfrd19ph0

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 help!
 
J

jacob navia

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 help!

#undef CreateFont

and you are all set
 
F

Flash Gordon

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.
 
F

Flash Gordon

CBFalconer wrote, On 13/04/08 00:34:
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++.
 
R

Richard

Flash Gordon said:
CBFalconer wrote, On 13/04/08 00:34:

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,949
Members
47,500
Latest member
ArianneJsb

Latest Threads

Top