banner
Tenifs

Tenifs

雄关漫道真如铁,而今迈步从头越。
github
follow
zhihu
email

Resolve go-sqlite3 requires cgo to work on Windows system

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

image

🆗, this completes the task.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.