Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 271547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:10:52+00:00 2026-05-12T00:10:52+00:00

Hard to come up with a proper title for this problem. Anyway… I’m currently

  • 0

Hard to come up with a proper title for this problem. Anyway…

I’m currently working on a GUI for my games in SDL. I’ve finished the software drawing and was on my way to start on the OpenGL part of it when a weird error came up. I included the “SDL/SDL_opengl.h” header and compile. It throws “error C2039: ‘DrawTextW’ : is not a member of ‘GameLib::FontHandler'”, which is a simple enough error, but I don’t have anything called DrawTextW, only FontHandler::DrawText. I search for DrawTextW and find it in a #define call in the header “WinUser.h”!

//WinUser.h
#define DrawText DrawTextW

Apparently it replaces my DrawText with DrawTextW! How can I stop it from spilling over into my code like that?

It’s a minor thing changing my own function’s name, but naming conflicts like this seem pretty dangerous and I would really like to know how to avoid them all together.

Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:10:53+00:00Added an answer on May 12, 2026 at 12:10 am

    You have a couple of options, all of which suck.

    • Add #undef DrawText in your own code
    • Don’t include windows.h. If another library includes it for you, don’t include that directly. Instead, include it in a separate .cpp file, which can then expose your own wrapper functions in its header.
    • Rename your own DrawText.

    When possible, I usually go for the middle option. windows.h behaves badly in countless other ways (for example, it doesn’t actually compile unless you enable Microsoft’s proprietary C++ extensions), so I simply avoid it like the plague. It doesn’t get included in my files if I can help it. Instead, I write a separate .cpp file to contain it and expose the functionality I need.

    Also, feel free to submit it as a bug and/or feedback on connect.microsoft.com. Windows.h is a criminally badly designed header, and if people draw Microsoft’s attention to it, there’s a (slim) chance that they might one day fix it.

    The good news is that windows.h is the only header that behaves this badly. Other headers generally try to prefix their macros with some library-specific name to avoid name collisions, they try to avoid creating macros for common names, and they try avoid using more macros than necessary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Can I assume that the scripts are being executed from… May 12, 2026 at 1:17 am
  • Editorial Team
    Editorial Team added an answer Try this rule: RewriteCond %{REMOTE_ADDR} !=127.0.0.0 [OR] RewriteCond %{HTTP_HOST} !=specific.host.example… May 12, 2026 at 1:17 am
  • Editorial Team
    Editorial Team added an answer Sun allows you to buy support packages for depreciated software… May 12, 2026 at 1:17 am

Related Questions

I am interested to learn about Eclipse RCP, I have got some basic knowledge,
It's hard to search for something when you don't know what it's called. I
For a typical business application, should the focus be on client processing via AJAX
I'm currently writing an application that works with modules. The module part is all
Assume you have five products, and all of them use one or more of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.