树莓派中安装QT

Posted 朝闻道

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了树莓派中安装QT相关的知识,希望对你有一定的参考价值。

树莓派中安装QT

 

 

本文博客链接:http://blog.csdn.net/jdh99,作者:jdh,转载请注明.

 

 

环境:

主机:WIN7

硬件:树莓派

 

步骤:

参考链接:http://qt-project.org/wiki/apt-get_Qt4_on_the_Raspberry_Pi

 

Firstly I got the development tools needed by Qt Creator in the hope it would be less heavy for the Pi to download separately.

  1. sudo apt-get install qt4-dev-tools

 

Then I went for Qt Creator

  1. sudo apt-get install Qtcreator

 

I also installed

  1. sudo apt-get install gcc
  2. sudo apt-get install xterm
  3. sudo apt-get install git-core
  4. sudo apt-get install subversion


this gives as a result Qt Creator 2.5 with Qt 4.8.1 32 bit

 

如果出现问题:e: unable to locate package qt creator,则输入以下命令更新

sudo apt-get update && sudo apt-get upgrade

 

如果还是有问题,尝试sudo apt-get install qtcreator

成功后可以运行qtcreator:
技术分享
此时还需要添加编译链:

Problem : no toolchain.

We can only compile for remote embedded devices and this is not the case here, because we are on the Pi and not remotely accessing it.

I added a gcc toolchain

Options > build & run > tab tool chain > button add
Choose GCC

  • Then set compiler path : /usr/bin/arm-linux-gnueabihf-gcc-4.6
  • Debugger : /usr/bin/gdb
  • Mkspec : default

 

Qt Creator seems to detect that we are going to deploy on a remote target.

To fix this :

  • Go to menu help > about plugins
  • Uncheck device support > remote linux
  • Restart Qt Creator
  • Go to tools > options TAB > build & run > Qt versions > add “/usr/bin/qmake-qt4”

 

It will then show up as a desktop project in the project wizard instead of embedded.

配置好之后,尝试运行一个简单的程序,效果如下:
技术分享
运行成功!不过编译很缓慢,正式开发估计还是得在PC上开发好之后再进行移植.

 

http://blog.csdn.net/jdh99/article/details/8738890

以上是关于树莓派中安装QT的主要内容,如果未能解决你的问题,请参考以下文章

树莓派在树莓派的Android系统中安装APK应用

树莓派中安装teamviewer

在树莓派 pi3 中安装 pip

sh 在Raspbian 9中安装AVRDUDE(树莓派模型B)

如何在树莓派 pi3 中安装模块 pytorch_lightning.metrics

怎么用VNC远程控制树莓派