Compile the Qt4 program with Code: Blocks on Ubuntu

Source: Internet
Author: User
1. Qt4 installation process $ sudoapt-getinstalllibqt4-devlibqt4-dbglibqt4-guilibqt4-sqlqt4-dev-toolsqt4-docqt4-designerqt4-qtconfig2. Pay attention to these two settings when creating a Qt4 project: Qt 'slocation:/usr "Debug/Release" op

1. Qt4 Installation Process
$ Sudo apt-get install libqt4-dev libqt4-dbg libqt4-gui libqt4-sql qt4-dev-tools qt4-doc qt4-designer

2. Pay attention to these two settings when creating a Qt4 project:
Qt's location:/usr
"Debug/Release" options Output dir.: And Objects output dir.: Set to null, that is, the project root directory.

3. When you need to use the Q_OBJECT macro, an error is reported when you Build the macro directly. We need to use Qmake:
Click [Tools]-> [Configure tools...] to add two new Tools:
1)
Name: Create Qt Project File
Executable:/usr/share/qt4/bin/qmake <-- the absolute path of qmake on the local machine
Parameters:-project
Working directory: $ {PROJECT_DIR}
Launching options select Launch tool hidden with standard output redirected
Note: The command line window will not pop up.
Click OK.

2)
Name: Create Qt Makefile
Executable:/usr/share/qt4/bin/qmake <-- the absolute path of qmake on the local machine
Parameters:-makefile
Working directory: $ {PROJECT_DIR}
Launching options select Launch tool hidden with standard output redirected
Note: The command line window will not pop up.
Click OK.

4. Click [Project]-> [Properties...]-> [Project settings],
Check "This is a custom Makefile" to use the custom Makefile.

5. Click the "Build targets" option page above,
Change the "Type:" drop-down list box to "GUI application ".

6. Click [Project]-> [Build options...]-> "Make" commands option page to delete all $ targets.

After the preceding settings are complete, use the Create Qt Project File and Create Qt Makefile tools before compilation,
You can build it again.

Code: Blocks: Click here
Code: Blocks: Click here

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

Related Article

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.