   LoadImage and windows.h
  So, I had code like this that worked great. However, one day I decided to include windows.h, and suddenly, it refused to compile.SDL_Surface* imageManager::LoadImage(const ImgDataStruct& data){    QPCTimer mytimer;    SDL_Surface* rval = data.Load();    Debug2("Loading time", mytimer.milliseconds());    return rval;}SDL_Surface* imageManager::DereferenceID(ImageID h){    assert(IsValid(h));    if (loadedimages.at(h) == NULL)    {   loadedimages.at(h) = LoadImage( loadedimgdata.at(h) );   assert((loadedimages.at(h)));    }    return loadedimages.at(h);}Eventually, I figured out that there was a windows function called LoadImage which was confusing the compiler. So I changed the lineloadedimages.at(h) = LoadImage( loadedimgdata.at(h) );to loadedimages.at(h) = imageManager::LoadImage( loadedimgdata.at(h) );This fixed most of the problems, but there was still one, baffling compiler error. Something like SDL_Surface* LoadImageA(const ImgDataStruct& data) not definedWhat the heck? "LoadImageA" does not appear anywhere in my source code. The only guess I had was that there is some macro in the winapi which is changing LoadImage to LoadImageA for some reason.Is this true? Why on earth would anyone ever create a macro that was a) defined in the main header, and b) not ALLCAPS?Also, is there any way to prevent the winapi from polluting the namespace? For now, I just renamed my LoadImage function, but ideally there's a better way. If I'm only using one or two of the windows functions, I don't want every single one.   
Quote:What the heck? "LoadImageA" does not appear anywhere in my source code. The only guess I had was that there is some macro in the winapi which is changing LoadImage to LoadImageA for some reason.I believe LoadImage is a macro that resolves to either LoadImage or LoadImageA depending on what character set is being used. In your case, it looks like it's resolving to LoadImageA, which is then  generating the error you mentioned.Quote:Is this true? Why on earth would anyone ever create a macro that was a) defined in the main header, and b) not ALLCAPS?Welcome to Windows :) In Windows' defense though, the Windows API has been around for some time, and a lot of this stuff is left over from the days of C where this sort of macro usage was much more common (at least I believe that to be the case - I'm sure someone will correct me if I'm wrong).Quote:Also, is there any way to prevent the winapi from polluting the namespace? For now, I just renamed my LoadImage function, but ideally there's a better way. If I'm only using one or two of the windows functions, I don't want every single one.Whenever I run into these problems, I just #undef the offending symbol(s) as necessary.   