SFML community forums

Bindings - other languages => C => Topic started by: Fabrizio Caruso on January 09, 2022, 12:48:13 am

Title: CSFML under Cygwin/Windows? How?
Post by: Fabrizio Caruso on January 09, 2022, 12:48:13 am
Is it possible to use CSFML under Cygwin/Windows?

I have never used CSFML. I am trying to compile a simple example but I have not found the C-specific documentation.

If I compile one example I am getting this error message:
...
In file included from ../CSFML-2.5.1-windows-64-bit/include/SFML/System.h:32,
                 from ../CSFML-2.5.1-windows-64-bit/include/SFML/Audio.h:32,
                 from test.c:1:
../CSFML-2.5.1-windows-64-bit/include/SFML/Config.h:73:6: error: #error This operating system is not supported by SFML library
   73 |     #error This operating system is not supported by SFML library
...

Does this mean I cannot use CSFML under Cygwin?
Title: Re: CSFML under Cygwin/Windows? How?
Post by: eXpl0it3r on January 09, 2022, 01:19:18 pm
By modifying some CMake scriptw you may get it to work, but Cygwin isn't officially supported, as it pretends to be a Unix environment, but should compile for Windows, so it's unclear which API needs to be used. As nobody has invested the time to figure it out, it was easier to fail for now.

If you want a Unix-like experience, I recommend msys2.
Title: Re: CSFML under Cygwin/Windows? How?
Post by: Fabrizio Caruso on January 13, 2022, 11:24:43 am
Ideally I would like to use Cygwin as environment but I can use Windows and/or Linux.
Is MINGW under Cywin supported MINGW in Cygwin targets WIN32 (and not Cygwin).
The reason why I prefer Cygwin is that it is the main environment I use for my project:
https://github.com/Fabrizio-Caruso/CROSS-LIB
I can also use plain Linux. I would prefer not to add a third environment (msys) unless I have no other choice or the other choices are way more complex.

I am a beginner with CSFML. What is the simplest setup that can get me started?
Does GCC under Linux work out of the box?
Title: Re: CSFML under Cygwin/Windows? How?
Post by: eXpl0it3r on January 13, 2022, 11:37:36 am
The simplest setup is probably to use CMake and Visual Studio.

Alternatives include MSYS2 or WinLibs

You can probably use Cygwin's compiler outside of the Cygwin environment
Title: Re: CSFML under Cygwin/Windows? How?
Post by: Fabrizio Caruso on January 17, 2022, 09:12:01 am
Thanks!
I will try to set up VS with CSFML but I have not found any tutorial on how to do it.
I have never used VS. I will need to figure it out. I see tutorials for SFML. I wonder if I could just follow them for CSFML.

I may give up Cygwin. I am not using its default compiler which aims at Cygwin and not Windows.
I am using MinGW (which exists under Cygwin and Windows proper).
Is MinGW supported by CSFML (in Windows proper)?
I downloaded precompiled versions of CSFML of:
https://www.sfml-dev.org/files/CSFML-2.5.1-windows-32-bit.zip
https://www.sfml-dev.org/files/CSFML-2.5.1-windows-64-bit.zip

I supposed that the .a files were meant for GCC under Windows (MinGW?)

My first attempt with MinGW (under Cygwin) fails with the linker complaining about them being incompatible:
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: skipping incompatible
...

I will also try MinGW under Windows proper (no Cygwin).
Title: Re: CSFML under Cygwin/Windows? How?
Post by: eXpl0it3r on January 17, 2022, 05:25:32 pm
The precompiled packages should work with MinGW as well, as you correctly determined.

Just make sure when you use a x64 to also use the 64bits libraries