2.3.1 windows安装therecipe/qt

文章目录

    • 安装 git 和 msys2
    • 安装golang1.10.1版本

对于qt来讲,属于跨平台的编程界面利器,基本上是用c++来写的,是否可以用go进行编写呢,答案是可行的。由于qt是跨平台的,而windows环境又较为复杂,大多数人开发则是在linux下进行。
但是在windows下开发就一定不行吗?答案是否定的,只不过配置较为复杂,我也是通过好长时间才实验成功的。
官方网址: https://github.com/therecipe/qt
参考官方 windows下安装步骤:
https://github.com/therecipe/qt/wiki/Installation-on-Windows
2.3.1 windows安装therecipe/qt_第1张图片
鉴于很多情况没有安装成功的,通过github查看遗留问题,发现此篇。翻译下如下
2.3.1 windows安装therecipe/qt_第2张图片

有可能一些小伙伴呀,重启电脑之后,或者命令行就不能进行编译了,其实很简单
设置静态链接,否则编译不通过
export QT_MSYS2_STATIC=true

下面咱们通过最新的win10 base镜像,进行解压到win10_goqt,运行
2.3.1 windows安装therecipe/qt_第3张图片

安装 git 和 msys2

参考:
http://doc.golangxb.com/read/xbhjdj/d3_1
http://doc.golangxb.com/read/xbhjdj/d3_2

安装golang1.10.1版本

运行go1.10.1.windows-amd64.msi
2.3.1 windows安装therecipe/qt_第4张图片
默认安装,然后进行下载
右键–>选择git bash
2.3.1 windows安装therecipe/qt_第5张图片
默认 c:/workspace/Golang 作为咱们的gopath路径
mkdir -p c:/workspace/Golang/src/golang.org/x
设置GOPATH环境变量
重新打开git bash,依次下载
2.3.1 windows安装therecipe/qt_第6张图片
2.3.1 windows安装therecipe/qt_第7张图片

cd c:/workspace/Golang/src/golang.org/x
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/dep.git
git clone https://github.com/golang/net.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/vgo.git
git clone https://github.com/golang/text.git
git clone https://github.com/golang/image.git
git clone https://github.com/golang/lint.git
git clone https://github.com/golang/time.git
git clone https://github.com/golang/term.git
git clone https://github.com/golang/sync.git

安装qt软件
下载地址: http://download.qt.io/official_releases/qt/5.11/5.11.1/
2.3.1 windows安装therecipe/qt_第8张图片
勾中的是必须选择的,其余是默认选择的
2.3.1 windows安装therecipe/qt_第9张图片
设置path全局变量
2.3.1 windows安装therecipe/qt_第10张图片
添加环境变量
QT_DIR
QT_MSYS2_DIR
QT_MSYS2_STATIC
2.3.1 windows安装therecipe/qt_第11张图片

用到什么环境变量就添加环境变量
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

2.3.1 windows安装therecipe/qt_第12张图片
pacman -Scc 这个我就不进行删除了,保留
go get -v github.com/therecipe/qt/cmd/...
设置静态链接,否则编译不通过
export QT_MSYS2_STATIC=true
备用:export QT_MSYS2_ARCH=amd64

2.3.1 windows安装therecipe/qt_第13张图片
$GOPATH/bin/qtsetup

这个时间可能会很长,长达1小时之巨
这样基本上都可以安装成功了,等待即可。
2.3.1 windows安装therecipe/qt_第14张图片
2.3.1 windows安装therecipe/qt_第15张图片

https://github.com/therecipe/qt/wiki/Getting-Started
go get -d -v github.com/therecipe/examples/...
cd $GOPATH/src/github.com/therecipe/examples
qtdeploy test desktop ./basic/widgets
2.3.1 windows安装therecipe/qt_第16张图片

go get -d -v github.com/therecipe/examples/...
cd $GOPATH/src/github.com/therecipe/examples
qtdeploy test desktop ./advanced/widgets/tableview
有可能360之类会阻拦,退出360就行了。
2.3.1 windows安装therecipe/qt_第17张图片

你可能感兴趣的:(Golang/docker,项目环境实战,qt.go)