How to configure Qt development environment of go language on Ubuntu Linux

Time:2020-9-18

goLanguage is highly efficient and runs at close speedCThe modern programming language of programs,qtCross platform excellenceguiKuo, the combination of the two works very well. This article talks about two things. The first is installationgoLinguisticqtBundle, the second is installationgoLanguage integrated development environment.

install github.com/therecipe/qt package

This section describes how to install and configuregithub.com/therecipe/qtDevelopment package, which is a very good oneqtLibrary’sgoLanguage binding, it is very powerful, perfect supportQTSignal slot mechanism, and it’sAPIComplete imitationC++So you can refer directly to the officialQT C++file.

The configuration method I introduced is bound to the system environmentqtInstead of using the author providedqtLibrary, the advantage of this is that the compiled program occupies a relatively small hard disk, otherwise the minimum program volume will exceed 30m.

Step 1: Downloadgithub.com/therecipe/qtSource code for

It is assumed that you have already installedgoCompiler, no more about how to install it. becausegithub.com/therecipe/qtThis bag must be inGOPATHMode installation and configuration, as we all know, domestic accessgithubThe speed is too slow, so if you use it directlygo getCommand automatic download installation is basically not feasible. I use code cloud accountforkSo we can use it from this addressgit cloneCommand Download:https://gitee.com/rocket049/qt。 The specific operation is 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

The second step, in theubuntuInstallation inqtDevelopment library of

useaptCommand to download allqtTo develop the library, just run the following command:

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

The third step is to compile the development tool suite

Just run the following command:

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

Step 4: compile, bind and edit${HOME}/.bashrc, add 2 lines to it:

export QT_PKG_CONFIG=true
#Here is the QT for Ubuntu 18.04_ API version. If the Ubuntu version is different, you should check the QT version in your system and fill in the corresponding version number
export QT_API=5.9.0

seeqtVersion of the method is: runapt-cache show libqt5core5a, find yourqtVersion number, attentionQT_APTThe last digit of the version number is written0Don’t copy itqtVersion number.

  • Run command import.bashrc. .bashrc, or reopen the terminal.
  • Run the installation command:$(go env GOPATH)/bin/qtsetup。 becauseqtThe library is very large, compiling takes a lot of time, please wait patiently, as long as it is completed successfullyinstallThat’s it. The next steptestThe process can be directCTRL-CEnd (and some test programs can not be compiled, because the latest version of a few API changes), does not affect the use.

Installing the liteide integrated development environment

My experiencevimvscodeliteideThere are three kinds of development environmentliteideIt’s the best, so I’ll give it backliteideThanks a lot to the author “Qiye”.githubThe project address on is:https://github.com/visualfc/liteideHis home page is:http://liteide.org/

Why do I say it’s the best because it’s in usegithub.com/therecipe/qtIt works best in this development package, which is very large, but usesliteideWhen programming, the automatic prompt is very fast, and there is no delay. However, when using the other two editors, there is an obvious pause when displaying the prompt information,vimIs particularly bad because it can only use new ones nowgoplsAs a background program for prompt information, however, its performance is very poor.

installliteideVery simple, we choose the fastest download from the download address provided by the author, and then unzip it to/optDirectory, and then create a launcher to use on the desktop. The specific method is as follows:

Unzip the downloaded package to/opt

cd /opt
Sudo tar xvfz / your / save / path / liteide- xxx.tar.gz

Edit the launcher and create the file on the desktopliteide.desktop, then open it in an 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 the start permission, open the terminal on the desktop, and enter the authorization command:chmod +x liteide.desktop

This is the end of this article. Thank you for your patience.

This article on how to configure the Qt development environment of go language on Ubuntu Linux will be introduced here. For more relevant content of Qt development environment of Ubuntu go language, please search the previous articles of developeppaer or continue to browse the related articles below. I hope you can support developeppaer more in the future!

Recommended Today

CSS uses position: sticky; to implement sticky layout

Four common attributes for positioning are as follows: { //1. The default value of positioning, no positioning, is equivalent to standard flow position:static; //2. Relative positioning, relative to the initial position of the element itself, usually set absolute (absolute positioning) to the child element of the parent element of relative position:relative; //3. Absolute positioning, relative […]