Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Renderers/Raylib] Including windows.h causes naming collision in Raylib LoadImage function #286

Open
Q-Alex-Q opened this issue Mar 1, 2025 · 1 comment

Comments

@Q-Alex-Q
Copy link

Q-Alex-Q commented Mar 1, 2025

I tried to add CURL through CMake and errors appears on LoadImage inside LoadTextureFromImage function. Error: argument of type "HANDLE" (aka "void *") is incompatible with parameter of type "Image" (aka "struct Image").

PS: Just noticed if I open project and quickly run project it will build and run but next time you try to run it will failed.

BTW i'm newbie at C/C++ and all this low level stuff so it could be because i did something wrong.

Image

@Ch40zz
Copy link

Ch40zz commented Mar 1, 2025

This happens because you include Windows.h which has lots of defines.
It defines LoadImage as LoadImageA in your case which is a Windows API, while the real LoadImage you wanted to call is a raylib API with an entirely different interface.

As a temporary workaround just do this at the top after including windows.h:

#undef LoadImage

I wonder which stance the author of the library will take on this, some libs let the user deal with this, others try to undef all of the windows nonsense such as min,max and many others.

@nicbarker nicbarker changed the title CURL naming collision error [Renderers/Raylib] CURL naming collision error Mar 2, 2025
@nicbarker nicbarker changed the title [Renderers/Raylib] CURL naming collision error [Renderers/Raylib] Including windows.h causes naming collision in Raylib LoadImage function Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants