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

(Win64) Incompatible type for argument 3 of 'sfRenderTexture_createWithSettings' #8

Closed
brus-fabrika opened this issue Nov 15, 2023 · 4 comments

Comments

@brus-fabrika
Copy link

When building basic_window example (Win10 64bit) there is a compilation error:

Graphics_wrap.c: In function '_wrap_sfRenderTexture_createWithSettings_graphics_0e245b41439e98a6':
Graphics_wrap.c:4902:76: error: incompatible type for argument 3 of 'sfRenderTexture_createWithSettings'
 4902 |   result = (sfRenderTexture *)sfRenderTexture_createWithSettings(arg1,arg2,(sfContextSettings const *)arg3);
      |                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                            |
      |                                                                            const sfContextSettings *
In file included from d:\development\libs\CSFML\include/SFML/Graphics.h:45:
d:\development\libs\CSFML\include/SFML/Graphics/RenderTexture.h:68:131: note: expected 'sfContextSettings' but argument is of type 'const sfContextSettings *'
   68 | CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_createWithSettings(unsigned int width, unsigned int height, sfContextSettings settings);
      |
~~~~~~~~~~~~~~~~~~^~~~~~~~

sfRenderTexture_createWithSettings in CSFML RenderTexture.h is indeed declared as accepting value object sfContextSettings, not the const pointer.

@brus-fabrika
Copy link
Author

brus-fabrika commented Nov 16, 2023

Update to the above - after manual update of the Graphics_wrap.c to pass the correct argument to underlying function sfRenderTexture_createWithSettings, I've got the linker errors:

C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
D:/development/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\brusa\AppData\Local\Temp\go-link-4052965474\000002.o:Graphics_wrap.:(.text+0x624a): undefined reference to `__imp_sfRenderTexture_createWithSettings'
D:/development/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\brusa\AppData\Local\Temp\go-link-4052965474\000002.o:Graphics_wrap.:(.text+0x6b41): undefined reference to `sfRenderTexture_getMaximumAntialiasingLevel'
D:/development/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\brusa\AppData\Local\Temp\go-link-4052965474\000002.o:Graphics_wrap.:(.text+0xbeef): undefined reference to `__imp_sfTexture_updateFromTexture'
collect2.exe: error: ld returned 1 exit status

I do believe this is neither the compiler nor the CSFML lib versions issues, because I was able to build and run corresponding C version of the basic example correctly.

@Telroshan
Copy link
Owner

Hey!
Just ran a fresh install as I had formatted my computer since then, and it worked just fine for me 😕
Could you tell me what your setup is? With versions and so on, so I can investigate, hopefully recreating the same bug in the same conditions!

I personnally ran :

If you don't run the bat script, please make sure :

  • You have properly set CGO_ENABLED, CGO_CFLAGS and CGO_LDFLAGS environment variables
  • You have copied the CSFML 64 bits DLL next to your exe

@brus-fabrika
Copy link
Author

@Telroshan hello!

After your comment I decided to make a fresh re-install of the building setup from the beginning and it just went fully fine at the end :) . My mistake was in CSFML version mismatch, somehow first time I downloaded 2.5 version, not the 2.5.1. With the latter it compiles and builds with no errors (except of deprecation warnings).

I will close the issue.

Thank you!

@Telroshan
Copy link
Owner

Perfect, I'm glad it's working, thanks for letting me know!

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