Public Group

# Odd Error Message

This topic is 3699 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

When I compile, on a function that I call: GLFont.TextOut(char*, int, int ,int); The compiler tells me on this line that there is no such function in class GLFont called TextOutA. It tags on an A... why is this? And how do I fix it?

##### Share on other sites
it's because 'TextOut' is already defined, as a macro, by the win32 headers, and resolves to the ANSI version of the TextOut Win32 function, hence the A. TextOut is a macro and TextOutA is the actual Win32 function.
You can solve this problem using #pragam pop/pushmacro with Visual C++:

#pragma push_macro("TextOut")#undef TextOut// here, you call GLFont.TextOut#pragma pop_macro("TextOut")

[Edited by - rolkA on May 29, 2008 2:06:59 AM]

##### Share on other sites
While that's a solution, there are other options.

1)If you plan on calling GLFont.TextOut a lot then consider wrapping that into a function like this(assuming C++):
GLFont_TextOut(GLFontType &GLFont, char *a, int b, int c, int d){#pragma push_macro("TextOut")#undef TextOutGLFont.TextOut(a, b, c, d);#pragma pop_macro("TextOut")}

2)If you never plan on using the Win32 macro TextOut, you can do this:
#include <windows.h>#undef TextOut// code

Perhaps you could wrap windows.h into your own header. my_windows.h and use that instead of windows.h while removing the macro. Hope this helps.

##### Share on other sites
Since I'm only using windows.h for MessageBox then I can probably safely #undef it. Thank you!

1. 1
Rutin
19
2. 2
3. 3
JoeJ
15
4. 4
5. 5

• 21
• 19
• 11
• 13
• 17
• ### Forum Statistics

• Total Topics
631697
• Total Posts
3001764
×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!