Credit to https://github.com/DennisPing/Windows-10-Cpp-MinGW64
Run powershell as admin
- Install go https://go.dev/learn/
- Install choco https://chocolatey.org/install
Restart powershell as admin
If you don't use cpp sfml, you only need mingw, tdm compiler also seems to work.
choco install mingw cmake make
Add cmake to path C:\Program Files\CMake\bin
In powershell check versions:
g++ --version
>> g++.exe (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
cmake --version
>> cmake version 3.21.3
make --version
>> GNU Make 4.3
Built for Windows32
- https://www.sfml-dev.org/download/sfml/2.4.0/ Download mingw 64bit
- https://www.sfml-dev.org/download/csfml/
Extract them to where you normally put your libraries, I put mine on D:\libs\x64
Add the following env variables to system, change path accordingly on first two, also note I renamed mine to CSFML-2.4
, instead of CSFML
:
Key : Value
CGO_SFML_INCLUDE D:\libs\x64\CSFML-2.4\include
CGO_SFML_LIB D:\libs\x64\CSFML-2.4\lib\gcc
CGO_CFLAGS -I%CGO_SFML_INCLUDE%
CGO_LDFLAGS -L%CGO_SFML_LIB%
CGO_ENABLED 1
Copy csfml from CSFML-2.4\bin to where your main.exe compiled, normally you only need the dlls you're importing.
NB: In powershell
go build .
go run .