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

Author Topic: Compiling SFML Project on Windows and Bash  (Read 1478 times)

0 Members and 1 Guest are viewing this topic.

firet

  • Newbie
  • *
  • Posts: 15
  • Gamedev, web dev and C++ programmer.
    • View Profile
    • Future Games official site
    • Email
Compiling SFML Project on Windows and Bash
« on: September 03, 2022, 12:42:20 am »
Hey! I recently set up the Debian terminal (bash) from the Windows store, and I've been trying to compile SFML apps into .exe files using x86_64-w64-mingw32-g++, but it hasn't been working. Is there any good way to compile SFML apps in the Debian terminal of Windows? (Effectively compile as EXE on Linux)
Online I am: firet; flesheatindragon; Future Games.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Compiling SFML Project on Windows and Bash
« Reply #1 on: September 06, 2022, 09:07:22 am »
What does "Debian terminal" mean exactly? :D
Are you using WSL2 and actually run Debian or is it just Bash running on Windows?

You build SFML apps the same way as you would with any other compiler or as with normal Windows CMD and MinGW. Highly recommend to use CMake as a build system, so you don't have to write custom build commands.

Here's an easy CMake template to get started with: https://github.com/eXpl0it3r/cmake-sfml-project
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

firet

  • Newbie
  • *
  • Posts: 15
  • Gamedev, web dev and C++ programmer.
    • View Profile
    • Future Games official site
    • Email
Re: Compiling SFML Project on Windows and Bash
« Reply #2 on: September 06, 2022, 06:58:00 pm »
WSL2 :)
Online I am: firet; flesheatindragon; Future Games.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Compiling SFML Project on Windows and Bash
« Reply #3 on: September 06, 2022, 08:55:28 pm »
Ah, you're the same person as on Discord :D

As mentioned, I don't really recommend cross-compiling and only recommend to run applications directly on Linux with VcXsrv or if you update to Windows 11 "natively".

If you stick to CMake you can easily build natively on Windows.

https://dev.my-gate.net/2022/06/18/code-and-run-apps-with-wsl2/
https://docs.microsoft.com/en-us/windows/wsl/tutorials/gui-apps
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

firet

  • Newbie
  • *
  • Posts: 15
  • Gamedev, web dev and C++ programmer.
    • View Profile
    • Future Games official site
    • Email
Re: Compiling SFML Project on Windows and Bash
« Reply #4 on: September 06, 2022, 11:52:35 pm »
I actually know the problem, I just don’t know how to solve it. I used apt-get to install SFML, but it installed into the folder that normal GCC uses, not x86_64-w64-mingw32-gcc. I don’t know how to install it to a different folder.
Online I am: firet; flesheatindragon; Future Games.