How do I configure the qt development environment for go on ubuntu linux

  • 2020-10-31 21:47:19
  • OfStack

go The language is extremely efficient and runs at close speed C Modern programming languages for programs, qt It's cross-platform excellence gui The library and the two work very well together. This article covers two things. The first is installation go The language of the qt Bundle package, the second is installation go Integrated development environment for the language.

Install github. com therecipe/qt package

How to install and configure it github.com/therecipe/qt Development kit, which is a very good one qt The library go Language binding, which is very powerful and perfectly supported C0 The signal slot mechanism, and its C1 Completely imitate C2 So you can refer directly to the official C3 The document.

The configuration method I describe is binding to the system environment qt Library, rather than using the author provided as the default installation qt Library. The advantage of this is that the compiled program takes up less disk space, otherwise the minimum program size is more than 30M.

Step 1: Download github.com/therecipe/qt The source code

It is assumed that you have already installed it go Compiler, no more instructions on how to install it. because github.com/therecipe/qt This bag must be in C9 Mode of installation and configuration is well known to our domestic access qt0 The speed is really slow, so if you use it directly qt1 Automatic command download installation is basically unworkable. I use code cloud account qt2 Take this package, so we can use it from this address qt3 Command Download: qt4 . Specific operations are as follows:


git
mkdir -p $(go env GOPATH)/src/github.com/therecipe
cd $(go env GOPATH)/src/github.com/therecipe
git clone --depth 1 https://gitee.com/rocket049/qt

Step 2 qt5 Installed in the qt The development of the library

with qt7 Command to download all qt To develop the library, simply run the following command:

[

sudo apt-get --no-install-recommends install libqt*5-dev qt*5-dev qml-module-qtquick-* qt*5-doc-html

]

Step 3. Compile the development tool suite

Just run the following command:

[

go get -v -tags=no_env github.com/therecipe/qt/cmd/...

]

Step 4. Compile the binding edit qt9 , add 2 lines:

[

export QT_PKG_CONFIG=true
Below is QT_API version of ubuntu18.04. If the ubuntu version is different, you should check the VERSION of qt on your system and fill in the corresponding version number
export QT_API=5.9.0

]

To view qt Version is: run gui1 Here you are qt Version number, note QT_APT The last bit of the version number is written 0 Don't copy qt The version number.

Run command import .bashrc : . .bashrc Or reopen the terminal. Run the installation command: $(go env GOPATH)/bin/qtsetup . because qt The library is very large and time consuming to compile. Please be patient as long as it completes successfully install That's it. That's it test The process can be direct CTRL-C End (and some tests won't compile because the latest version has a few changes to API), not affecting usage.

Install the liteide integrated development environment

I have vim , vscode , liteide Three development environments, the conclusion is liteide It's the best. I'll give it back liteide The author paid the money, thanks very much to the author "7 leaves". qt0 The project address is: https://github.com/visualfc/liteide , his homepage is: qt0 .

Why do I say it's best just because it's in use github.com/therecipe/qt It works best when it comes to this development package, which is very large but used liteide When programming, the autoprompt is very fast with almost no delay, while when using the other two editors, the prompt message is displayed with obvious pauses, vim It performs particularly poorly because it can only use the new one now qt4 Background program as a prompt message, however, its performance is very poor.

The installation liteide Very simple, we just choose one of the fastest downloads from the download address provided by the author, and then unzip to qt6 Directory, and then make a launcher on the desktop can be used, the specific method is as follows:

Unzip the downloaded zip file to qt6

[

cd /opt
sudo tar/Your/save/path/ES130en-ES131en.tar.gz

]

Edit the launcher to create files on the desktop qt8 , then open it in the editor and enter the following:


[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=/opt/liteide/share/liteide/welcome/images/liteide128.xpm
Exec=/opt/liteide/bin/liteide
Name=Liteide
Comment=Lite ide

Then give it boot permissions, open the terminal on the desktop, and enter the authorization command: qt9

This is the end of this article, thanks for your patience to read.


Related articles: