优秀的编程知识分享平台

网站首页 > 技术文章 正文

MacOS上安装gotk3(macos上安装origin)

nanyue 2024-08-13 07:55:29 技术文章 11 ℃

MacOS上安装gotk3:

echo 'export GOPROXY=https://goproxy.cn'>>~/.bash-profile

echo 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig'>>~/.bash-profile

echo 'export GO111MODULE=auto'>>~/.bash-profile

source ~/.bash-profile


安装需要的3个包:

brew install pkg-config gtk+3 adwaita-icon-theme

go get github.com/gotk3/gotk3/gtk


注意:

安装过程中有error 提示的要执行其建议的命令:

brew link --overwrite freetype


#将freetype2 for gtk,作为新的freetype 。旧的软连接要被替换掉。否则,gtk编译时找不到freetype2


使用module模式编译项目,需要在项目目录上及目录下运行:

go mod init <项目名>

以生成go.mod配置文件。


编译运行一个示例代码:

go run test.go


最近发表
标签列表