Sign in to follow this  

Odd Error Message

This topic is 3487 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
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

This topic is 3487 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this