Qt library compilation and environment variable settings in Ubuntu

Source: Internet
Author: User
I. Static Qt Compilation: Recently, the project is to be transplanted to the Linux platform, so we need to re-compile Qt on Linux. 1. First configure some programs used to compile Qt, use the following command: sudoapt-getinstallbuild-essentiallibpcap0.8-devlibx11-devlibfreetype6-devlibavahi-gobject-devlibSM-devlibXrender-

I. Static compiling Qt:

Recently, the project has to be transplanted to the Linux platform, so we need to re-compile Qt on Linux.

1. First, configure the program to be used to compile Qt and run the following command:

Sudo apt-get install build-essential libpcap0.8-dev libx11-dev libfreetype6-dev libavahi-gobject-dev libSM-dev libXrender-dev libfontconfig-dev libXext-dev

2. then download the qt-everywhere-opensource-src-xxx.tar.gz source package from qtguan. Address: ftp://ftp.qt.nokia.com/qt/source/

3. Extract

4. Configure path: export PATH = "$ PATH:/usr/local/Trolltech/Qt-4.7.1/bin"

5. configure the configure:./configure-static -- debug-and-release-nomake demos-nomake examples-no-limits tions of Qt.

-Static is used to specify static compilation;

-Nomake demos is used to specify the demos directory that does not compile qt, and examples is also used;

6. make

7. make install

Ii. Set Environment Variables

1. Run the command gedit ~ /. Profile to edit the file. Add the following to the file:

Export QTDIR =/usr/local/Trolltech/Qt-4.7.4/* need to modify your Qt installation directory */
Export LD_LIBRARY_PATH = $ QTDIR/lib
Export PATH = $ PATH: $ QTDIR/bin

Save and close the file.

2. Run the command source ~ /. Profile.

In this way, you can use qmake in any directory.

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.