Because this book mainly introduces the programming of Qt under Linux, here only introduces QT installation under Linux.
About Linux installation, not the content of this book, if you have not touched Linux, start with the Learning Linux Foundation.
First download QT, enter http://www.trolltech.com/download/index.html download page, select GPL Versions, click QT / X11 Free link address,
Select it
After clicking, there is a corresponding download link to download the QT-X11-Free-3.3.2.tar.gz file.
Before installation, you may need root permissions, depending on the permissions of the path you want to install, first, unzip the compressed file.
CD / usr / local
Gunzip QT-X11-free-3.3.2.tar.gz # decompressed this package
TAR XF QT-X11- Free-3.3.2.tar # 解包 这包
Direct
CD / usr / local
TAR -ZXVF QT-X11-free-3.3.2.tar.gz
The execution will generate a / usr / local / qt-x11- free-3.3.2 directory containing the main packages, rename QT-X11- Free-3.3.2 (or establish a link):
MV QT-X11-free-3.3.2 qt
Here, it is assumed that Qt is to be installed to / usr / local / qt path
The.profile file (or .login file, depending on your shell) set some environment variables in your shell.
o Qtdir - you install QT path
o Path - Used to locate the MOC program and other QT tools
o MANPATH - Access the path to the QT Man format help document
o LD_LIBRARY_PATH - the path to the shared QT library
Example:
In the .profile file (if your shell is Bash, KSH, ZSH or SH), add these lines:
Qtdir = / usr / local / qt
PATH = $ qtdir / bin: $ PATH
MANPATH = $ qtdir / man: $ manpath
LD_LIBRARY_PATH = $ qtdir / lib: $ ld_library_path
Export Qtdir Path ManPath LD_Library_Path
Add these lines below if the .login file (if your shell is CSH or TCSH)
Stenv QTDIR / USR / local / qt
SetENV PATD $ qtdir / bin: $ PATH
SetENV MANPATH $ qtdir / man: $ manpath
STENV LD_LIBRARY_PATH $ qtdir / lib: $ ld_library_path
After you finish these, you need to log in, or re-specify your profile before you continue to work, so that at least $ qdir is set. Otherwise, the installer will give an error message and no longer go.
Install your license file. For free versions, you don't need a license file. For both professional and enterprise version, you need to install a license file that is consistent with your distribution.
Compile QT libraries, and compile examples, tutorials, and tools (such as QT designers), just like this.
enter:
./configure
This is the QT library for your machine. Note that the GIF file support option is turned off under the default condition. Run ./configure -help will get a list of configuration options. Read the Platforms file to get a list of supported platforms. Generate libraries and compile all routines and tutorials:
Make
According to the configuration of your machine, there is not much compilation speed, you need to wait for a while.
If you have a problem, please see http://www.trolltech.com/platforms/.
In terms of few cases, if you use a shared library, you may need to run / sbin / ldconfig or other similar things.
If you encounter problems when you run an instance program, such as the news is as follows
Can't load library 'libqt.so.2'
You may need to give a set of QT libraries in the configuration file and run / sbin / ldconfig in your system as root's identity. And you don't forget to set an LD_Library_Path environment variable in the second step in the second step.
Online HTML document is installed to / usr / local / qt / doc / html /, the main page is /usr/local/qt/doc/html/index.html. The Man Help document is installed / usr / local / qt / doc / man /.
You have finished. Qt has been installed. After the installation is complete, you will not add a menu on the Start menu just like a Windows installer.
In Linux Command Mode, type the following command
Designer
You can see the Qt Designer interface. For convenience, you can add a shortcut to your desktop.
Qt provides several command lines and graphics tools to mitigate and accelerate development processes.
l QT Designer Visual Design Window
l QT linguist translation application enables it to enter the international market
l Qt Assistant quickly discovered the help you need
l qmake generates Makefile by a project file that is not related to simple Yu Baodai
l QEmbed conversion data, such as turning the picture as C code
l qvfb runs and tests embedded applications on the desktop
l MakeQPF provides pre-made fonts for embedded devices
l MOC meta-object compiler
l UIC user interface compiler
l QTconfig A UNIX-based QT configuration tool, here is online help
Section
This chapter mainly introduces the installation of QT under Hongli Linux Desktop 4.1, at least QT in other systems installation methods, you can view the installation instructions in detail, you can decompress in Linux, Reference / usr / local / qt directory install Documentation.