Qt-Based Gui User Application - GARZ&FRICKE GUF-Yocto-34.0-r5756-0-VINCELL User Manual

Embedded computer systems
Table of Contents

Advertisement

{
cout << "Hello World!" << endl;
return 0;
}
Edit the contents of the
Makefile
myapp: main.cpp
$(CXX) ${CXXFLAGS} -o $@ $<
$(STRIP) $@
clean:
rm -f myapp * .o * ~ * .bak
It is necessary to setup your build environment so that the complier, headers and libraries can be found. This is
done by "sourcing" a build environment configuration file. If the toolchain is installed in the default directory, this
example compiles for the target system by typing
!
$ source
/opt/guf/GUF-Yocto-34.0-r5756-0-sdk/environment-setup-vincell-guf-linux-gnueabi
,
$ make
in the
directory. The first line is needed only once as it configures the current shell and sets the necessary
myapp
environment variables.
After a successful build, the
to the target system's
/usr/bin
system]
and execute it from the device shell. It might be necessary to change the access rights of the executable
first, so that all users are able to execute it.
You can find further information about how to build applications for Yocto-based platforms at:
I
https://www.yoctoproject.org/docs/current/adt-manual/adt-manual.html

7.3 Qt-based GUI user application

Create a new directory in your home directory on the host system and change to it:
$ cd ~
$ mkdir myqtapp
$ cd myqtapp
Create the empty files
main.cpp
$ touch main.cpp myqtapp.pro
Edit the contents of the file
#include <QApplication>
#include <QPushButton>
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
app.setOverrideCursor(Qt::BlankCursor);
QPushButton hello("Hello World!");
hello.setWindowFlags(Qt::FramelessWindowHint);
hello.resize(800, 480);
hello.show();
return app.exec();
}
Edit the contents of the file
as follows:
maypp
executable is created in the
directory using one of the ways described in chapter
and myqtapp.pro.
as follows:
main.cpp
as follows:
myqtapp.pro
GUF-Yocto-34.0-r5756-0
myapp
directory. You can transfer this application
VINCELL
User Manual
¡
¡
I
[
3 Accessing the target
37

Advertisement

Table of Contents
loading

Table of Contents