You can run "grep -ir LoadImage" to figure out what kind of definition
for LoadImage is provided by mingw-w64.

It looks like include/winuser.h has this line:

  #define LoadImage __MINGW_NAME_AW(LoadImage)

So in your header file for your LoadImage class, you can simply write:

  #undef LoadImage

C does not have namespaces.  The Windows API from Microsoft defines
functions with very broad names, LoadImage, GetLastError, CreateFile,
etc.  In order to compile Windows software successfully, mingw-w64 has
to provide definitions for Windows API functions like that.

I would recommend changing the name of your class.  When an
experienced Windows programmer sees "LoadImage(...)" in your code they
might think you are calling the Windows LoadImage functions but you
are actually constructing an instance of your class.

--David Grayson

On Tue, Mar 14, 2017 at 3:42 AM, Mario Emmenlauer <[email protected]> wrote:
>
> I'm not sure where to ask about this, please redirect me as needed!
>
> I have a C++ class with a function "LoadImage", which caused a
> compile error on Windows. After some digging, I think that a define or
> function from winuser.h with a similar name is the culprit. I'm slightly
> confused by this, because I naiively assumed that such global defines
> would be better obscured. Admittedly I'm quite ignorant as to how this
> "hiding" should work, I just assumed that i.e. they would have very
> specific names, are encapsulated in namespaces, or live in very specific
> headers.
>
> Is there some way for me not to fall into the same trap with other
> functions again? I recall some WIN32_LEAN_AND_MEAN define that was
> used in the old days to reduce the bloat coming from windows headers,
> when using MSVC. Is this still useful, and/or are there better methods?
>
> Thanks for and advise!
>
> All the best,
>
>     Mario Emmenlauer
>
>
> --
> BioDataAnalysis GmbH, Mario Emmenlauer      Tel. Buero: +49-89-74677203
> Balanstr. 43                   mailto: memmenlauer * biodataanalysis.de
> D-81669 München                          http://www.biodataanalysis.de/
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to