/************************************************************************ * Building QT projects from the command line * 说明: * 很多时候都是通过Qtcreator进行项目的创建以及编译,但是有时候可能 * 会遇到一些编译小问题,这时候命令行创建工程、编译工程可以作为测试、验证 * 的一种手段。 * * 2016-3-2 深圳 南山平山村 曾剑锋 ***********************************************************************/ 一、参考文档: Building QT projects from the command line http://processors.wiki.ti.com/index.php/Building_QT_Projects 二、基本操作流程: 1. After Installing your host Ubuntu and then the SDK on your host machine: [How to install Ubuntu and your SDK] 在你电脑上安装Ubuntu及SDK。 2. Create a new directory on your Ubuntu 10.04 host. 在Ubuntu中创建一个目录,叫:hello-world。 user@user-desktop:~$mkdir hello-world 3. Change to that directory 进入刚刚创建的目录 。 user@user-desktop:~$cd hello-world 4. Source the environment setup to get access to qmake and the gcc compiler 导入环境变量,这样你才能够使用qmake和gcc编译器。 user@user-desktop:~/hello-world$ source /home/user/ti-sdk-am335x-evm-05.03.00.00/linux-devkit/environment-setup 5. Create a new file: hello-world.cpp and copy in the following source code to hello-world.cpp 创建hello-world.cpp文件,并将以下源代码拷入文件中。 #include <QApplication> #include <QLabel> int main(int argc, char **argv) { QApplication app(argc, argv); QLabel label("Hello World!"); label.show(); return app.exec(); } 6. Execute the following commands: (If you already have a project file skip step 1) 执行以下命令:(如果你已经有一个工程项目文件,请跳过这一步) [linux-devkit]:~/hello-world> qmake -project // The first command creates a project file: hello-world.pro. [linux-devkit]:~/hello-world> qmake // The second generates a makefile based on the project file. [linux-devkit]:~/hello-world> make // The third compiles and builds the project. 7. This is what you have just created 这是刚刚你创建的文件,或者生成的文件。 [linux-devkit]:~/hello-world> ls hello-world hello-world.cpp hello-world.o hello-world.pro Makefile 8. copy the hello-world binary over to your file system and run hello-world on your target. 将hello-world二进制文件拷入你的文件系统,并在目标机器上运行。