Introduction#
When using go-sqlite3 to connect to the sqlite database on Windows systems, the project runs into an error, and the error message is as follows:
Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
Cause of the Problem#
The Windows system does not have gcc installed by default, so cgo cannot work.👆🤓
Solution#
Windows systems can obtain gcc by installing mingw.😡
Minimalistic GNU for Windows is a runtime environment for GCC, GDB, make and related binutils.
I directly used scoop for one-click installation, entering the following commands in the terminal:
scoop bucket add main
scoop install main/mingw
After running the above commands, test whether gcc is installed successfully.
gcc -v
🆗, this completes the task.