Quick development of QT applications under Ubuntu14.04, ubuntu14.04qt
Find: demonstrate how to quickly develop QT applications.
1. Install the Qt Integration Environment in Ubuntu
Sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos
2. Compile a simple Qt Program
First, create an application folder qtapp and enter the folder
Cd ~
Mkdir qtapp
Cd qtapp
Program writing:
Gedit test1.cpp
The content is as follows:
#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();}
3. Generate a project file irrelevant to the platform
~ /Qtapp $ qmake-project
A project file named qtapp. pro is obtained.
4. Generate the makefile file
~ /Qtapp $ qmake qtapp. pro
Get the Makefile file
5. Generate the target file
~ /Qtapp $ make
The displayed information is:
G ++-c-m64-pipe-O2-Wall-W-D_REENTRANT-DQT_NO_DEBUG-DQT_GUI_LIB-DQT_CORE_LIB-DQT_SHARED-I/usr/share/qt4/mkspecs/linux-g + +-64-I. -I/usr/include/qt4/QtCore-I/usr/include/qt4/QtGui-I/usr/include/qt4-I. -I. -o test1.o test1.cpp
G ++-m64-Wl,-O1-o qtapp test1.o-L/usr/lib/x86_64-linux-gnu-lQtGui-lQtCore-lpthread
Get the qtapp Executable File
6. Execute the target file
./Qtapp
Visible program window (carefully find it on the screen, because it is relatively small)