Jump to content
  • Advertisement
Sign in to follow this  
Niddles

Odd Error Message

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 TextOut
GLFont.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 this post


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

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!