Linux compiles and installs the full Qt 4.53 configuration process

Source: Internet
Author: User

Recently ready to do Nokia Symbian,maemo under the touch screen development. Considering the cross-platform portability of the program, the final choice is to use Qt development. Relatively speaking, the domestic Qt related documents are not much. The author will compile and install Linux under the Qt full process summary, only hope that can be convenient for more friends!

1. Get Source code
SRC Official website: ftp://ftp.qt.nokia.com/qt/source/
Qt-x11-opensource-src-4.5.3.tar.gz released on October 1, 2009, size 122 Mb.

2. Unzip
Tar Xvfz qt-x11-opensource-src-4.5.3.tar.gz

        3. Generate Makefile file  
       ./configure
         this time he will ask you: "Which edition of Qt does you want to use?"
        then give you two types to choose from:
        type ' C ' If you want-use the commercial Edition.
        Type ' o ' If you want the Open Source Edition.
        The first one is the commercial version, the second is the free version.
        Select ' O ' (qt/embedded free version is Qt in order to develop the embedded version provided by Free software).
        the licensing interface appears.
        Select   ' yes ' to accept the license agreement.
        Start generating the makefile file. This will take about 5-10 minutes.

4. Qt compilation
Gmake
This process takes a long time and requires about two hours.

5. Qt Installation
Run Gmake Install
Default installation to/usr/local/trolltech/qt-4.5.3
About 5-10 minutes. Normal end, installation complete.
Run the/usr/local/trolltech/qt-4.5.3/bin/designer and see Qt start, which means Qt is installed.

6. Setting environment variables

One. Modify user Environment Variables first

Vi/home/defonds/.bashrc

Add the following information at the end of the

Export qtdir=/usr/local/trolltech/qt-4.5.3
Export path= $QTDIR/bin: $PATH
Export manpath= $QTDIR/man: $MANPATH
Export ld_library_path= $QTDIR/lib: $LD _library_path

Two. Then modify all user environment variables

Vi/etc/profile
Add the following information at the end of the
Export qtdir=/usr/local/trolltech/qt-4.5.3
Export path= $QTDIR/bin: $PATH
Export manpath= $QTDIR/man: $MANPATH
Export ld_library_path= $QTDIR/lib: $LD _library_path

Three. Test it.

Re-open a terminal and enter the command:

Qmake-v

Output Result:

QMake version 2.01a
Using Qt version 4.5.3 in/usr/local/trolltech/qt-4.5.3/lib
Enter the command:

Which Qmake

Output Result:

/usr/local/trolltech/qt-4.5.3/bin/qmake
Demonstrate that the QT environment variable has been configured successfully.

Editor's note

Linux starts by reading the user environment variable, which is the/HOME/DEFONDS/.BASHRC setting. Read all user environment variables, that is, the configuration in/etc/profile.

Start Qt

Write a simple QT program that uses the installed QT compilation to test its performance
Create a new file named Hello.cpp with the following contents:
#include <QApplication> #include <QLabel> int main (int argc,char *argv[]) {qapplication app (ARGC,ARGV); Qlabel *label = new Qlabel ("Hello qt!"); Label->show (); return App.exec (); }
To save the hello.cpp, compile the process as follows:
In the directory where the Hello.cpp is located, run the command
Qmake-project
Hello.cpp the same directory with the Hello.pro file is generated, it is platform-independent engineering files.
In the directory where the Hello.cpp is located, run the command
Qmake Hello.pro
The Makefile file in the same directory is generated (Makefile is the configuration file that instructs the compiler to compile the source code, and the Make command is entered in its directory (NMAKE is in the WIN32,VC6 environment) to complete the compilation.
In the directory where the Hello.cpp is located, run the command
Make
HELLO,HELLO.O two files in the same directory are compiled and generated. Where Hello is the executable that was generated using QT compilation under the current Linux system. Double-click Run Hello, "Hello qt!" text box pops up, ok! This step proves that Qt can be fully operational on your computer. What are you waiting for, to start your exciting and enjoyable Qt development journey!

Http://www.itboth.com/d/Z3YVJv/makefile-library-path-linux-qt

Linux compiles and installs the full Qt 4.53 configuration process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.