白夜瞭望

夢の中の夢
うつし世はゆめ 夜の夢こそまこと
  1. 首页
  2. 软件
  3. 正文

用Golang开发GUI程序(01)安装Golang、QT并设置相关变量

2019年4月23日 9020点热度 6人点赞 0条评论

Contents

安装 git 、golang、msys2、qt

去各自官网下载即可

git

官网:https://git-scm.com/
装好后,在PATH里添加:
C:\Program Files\Git\cmd

golang

官网下载页面:https://golang.org/dl/
下载压缩包(go1.12.4.windows-amd64.zip),我选择解压到“D:\soft\go”。
因为不是msi版,所以需要自己添加golang系统变量:

# GOROOT
D:\soft\Go\
# GoPath
D:\soft\gopath

加入PATH
D:\soft\gopath\bin;D:\msys64\mingw64\bin

msys2

去官网(https://www.msys2.org/)下载安装包,一路下一步即可。
我把安装路径改成了“ D:\msys64 ”。

利用msys2安装QT包

用到什么环境变量就添加环境变量
pacman -Syyu
pacman -S gcc
pacman -S mingw-w64-x86_64-qt-creator mingw-w64-x86_64-qt5
pacman -S mingw-w64-x86_64-qt-creator mingw-w64-x86_64-qt5-static
pacman -Scc

设置环境变量

QT相关

# QT_DIR
D:\msys64\mingw64\qt5-static
#QT_MSYS2_DIR
D:\msys64
# QT_MSYS2_ARCH
amd64
# QT_WEBKIT
true
#QT_MSYS2_STATIC
true

安装therecipe/qt

安装环境

可能需要翻墙,然后需要较长时间(1~2小时)

go get -v github.com/therecipe/qt/cmd/...
$GOPATH/bin/qtsetup

测试demo

go get -d -v github.com/therecipe/examples/...
cd $GOPATH/src/github.com/therecipe/examples
qtdeploy test desktop ./basic/widgets

参考文档:
windows安装therecipe/qt
【golang-GUI开发】Qt5的安装
therecipe/qt: Qt binding for Go (Golang)
therecipe/qt Installation on Windows

本作品采用 知识共享署名 4.0 国际许可协议 进行许可
标签: 暂无
最后更新:2019年7月11日

bai

文案为生的业余画师,偶尔客串程序员。

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

Copyright © 2022 yumenaka.net All Rights Reserved.

Theme Kratos Made By Seaton Jiang