Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: CSFML under Cygwin/Windows? How?  (Read 7591 times)

0 Members and 3 Guests are viewing this topic.

Fabrizio Caruso

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
CSFML under Cygwin/Windows? How?
« 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: CSFML under Cygwin/Windows? How?
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Fabrizio Caruso

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: CSFML under Cygwin/Windows? How?
« Reply #2 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: CSFML under Cygwin/Windows? How?
« Reply #3 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
« Last Edit: January 13, 2022, 11:41:47 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Fabrizio Caruso

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: CSFML under Cygwin/Windows? How?
« Reply #4 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).

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: CSFML under Cygwin/Windows? How?
« Reply #5 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
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/