If you already have Go and SDL2 installed in WSL2 and they are working, please ignore this guide.
-
You should already have Go (native windows) https://golang.org/dl/ installed on your machine.
-
Download mingw-w64 here.
-
Open installer, Select
x86_64
(AMD64) as Architecture, and leave the rest as default. -
The default destination folder should be
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0
, we will take this path as example. -
Search
advanced system settings
, click onEnvironment Variables
, inSystem variables
list, double click onPath
. -
Add a new variable
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
.(if you already have Haskell installed on your machine, you probably need to move the newly added variables to the top of the list using
Move Up
button) -
To confirm, open a new PowerShell and type
(gcm gcc).path
, make sure the path is the same as above. -
Download SDL2 https://www.libsdl.org/download-2.0.php, move on to
Development Libraries
Windows
and downloadSDL2-devel-2.x.xx-mingw.tar.gz(MinGW 32/64-bit)
.(make sure you are downloading Development Libraries for MinGW and not for Visual C++) -
Unzip it and open
x86_64-w64-mingw32
, copy these four foldersbin
include
lib
share
toC:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\
as well as
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32
(You should copy those four folders to both of the path above)
-
Open your coursework folder, start a terminal and type
go run .
The system will download dependency packages according to go.sum and go.mod. This usually takes a few minutes for cgo to prepare for the first run.
If you see the followings showing up in the terminal, you are ready for the coursework.
Threads: 8 Width: 512 Height: 512 Completed Turns 0 Quitting