Building QT Projects

From Texas Instruments Wiki
Jump to: navigation, search

Building QT projects from the command line

user@user-desktop:~$mkdir hello-world
  • Change to that directory
user@user-desktop:~$cd hello-world
  • Source the environment setup to get access to qmake and the gcc compiler
user@user-desktop:~/hello-world$ source /home/user/ti-sdk-am335x-evm-
  • Create a new file: hello-world.cpp and copy in the following source code to hello-world.cpp
#include <QApplication>
#include <QLabel>

int main(int argc, char **argv)
    QApplication app(argc, argv);
    QLabel label("Hello World!");;
    return app.exec();
  • Execute the following commands: (If you already have a project file skip step 1)
  1. [linux-devkit]:~/hello-world> qmake -project // The first command creates a project file:
  2. [linux-devkit]:~/hello-world> qmake // The second generates a makefile based on the project file.
  3. [linux-devkit]:~/hello-world> make // The third compiles and builds the project.

  • This is what you have just created
[linux-devkit]:~/hello-world> ls
hello-world  hello-world.cpp  hello-world.o  Makefile
  • copy the hello-world binary over to your file system and run hello-world on your target.