Compiling Qt Apps
Click here to load reader
-
Upload
jussi-pohjolainen -
Category
Technology
-
view
1.049 -
download
1
Transcript of Compiling Qt Apps
![Page 1: Compiling Qt Apps](https://reader038.fdocuments.us/reader038/viewer/2022100523/554e28fcb4c9056b798b5237/html5/thumbnails/1.jpg)
Compiling Qt -‐ apps
Jussi Pohjolainen Tampere University of Applied Sciences
![Page 2: Compiling Qt Apps](https://reader038.fdocuments.us/reader038/viewer/2022100523/554e28fcb4c9056b798b5237/html5/thumbnails/2.jpg)
source.cpp #include <QtWidgets>
int main(int argc, char *argv[]){ QApplication a(argc, argv);
QLabel b; b.setText("moi"); b.show();
return a.exec();}
![Page 3: Compiling Qt Apps](https://reader038.fdocuments.us/reader038/viewer/2022100523/554e28fcb4c9056b798b5237/html5/thumbnails/3.jpg)
Crea@ng Project
• Create new projecBolder and save the source.cpp into the folder – /QtHelloWorld/source.cpp
• Create plaBorm independent project file – qmake –project
• Creates – /QtHelloWorld/QtHelloWorld.pro
![Page 4: Compiling Qt Apps](https://reader038.fdocuments.us/reader038/viewer/2022100523/554e28fcb4c9056b798b5237/html5/thumbnails/4.jpg)
pro? ###################################################################### # Automatically generated by qmake (3.0) ke maaliskuuta 4 10:34:14 2015
######################################################################
TEMPLATE = app
TARGET = QtHelloWorld
INCLUDEPATH += .
# add this!
QT += widgets
# Input
SOURCES += source.cpp
![Page 5: Compiling Qt Apps](https://reader038.fdocuments.us/reader038/viewer/2022100523/554e28fcb4c9056b798b5237/html5/thumbnails/5.jpg)
qmake
• AGer building the project – file, we well create a pla$orm specific makefile
• makefile = informa@on how to build the target program (compile instruc@ons)
• In Mac OS X, the qmake creates automa@cally Xcode – project files. Use: qmake -spec macx-g++
• In other systems, qmake should be enough.
![Page 6: Compiling Qt Apps](https://reader038.fdocuments.us/reader038/viewer/2022100523/554e28fcb4c9056b798b5237/html5/thumbnails/6.jpg)
qmake usage on Mac OS X
![Page 7: Compiling Qt Apps](https://reader038.fdocuments.us/reader038/viewer/2022100523/554e28fcb4c9056b798b5237/html5/thumbnails/7.jpg)
make and running
• make will compile the applica@on using the instruc@ons in the makefile
• AGer compila@on you can run the applica@on
![Page 8: Compiling Qt Apps](https://reader038.fdocuments.us/reader038/viewer/2022100523/554e28fcb4c9056b798b5237/html5/thumbnails/8.jpg)
Compiling and Running
![Page 9: Compiling Qt Apps](https://reader038.fdocuments.us/reader038/viewer/2022100523/554e28fcb4c9056b798b5237/html5/thumbnails/9.jpg)
Build Steps
• qmake –project – Creates plaBorm independent project file
• qmake – Creates plaBorm specific makefile
• make – Compiles the applica@on
• ./helloworld – Starts the app (depends on the plaBorm)