-
1. No tool chain set from kit “Desktop”.
-
打开qtcreator时出现上述错误,原因是qtcreator的编译器配置项没有找到可用的编译器,查看是否下载了可用的g++,如果下载了也detected不到,那就手动添加,添加完成后就行了。
-
2. make: arm-none-linux-gnueabi-g++: Command not found
-
/usr/local/Qt5.6-arm/bin/uic ../../PZJBY/MainWindow.ui -o ui_MainWindow.h arm-none-linux-gnueabi-g++ -c -pipe -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../PZJBY -I. -I/usr/local/Qt5.6-arm/include -I/usr/local/Qt5.6-arm/include/QtWidgets -I/usr/local/Qt5.6-arm/include/QtGui -I/usr/local/Qt5.6-arm/include/QtCore -I. -I. -I/home/anzyelay/Desktop/arm/tslib/mybuild/include -I/usr/local/Qt5.6-arm/mkspecs/linux-arm-gnueabi-g++ -o main.o ../../PZJBY/main.cpp make: arm-none-linux-gnueabi-g++: Command not found make: *** [main.o] Error 127 15:51:58: 进程"/usr/bin/make"退出,退出代码 2 。 Error while building/deploying project PZJBY (kit: nanopi) When executing step "Make"
qmake 用到的mkspecs配置文件qmake.conf有问题,如果仅仅是编译器名字不对可以直接修改,不同平台编译时除了要指定相应的qmake,还要设置好QMAKESPEC宏,例如
针对arm-linux平台: export
QMAKESPEC=/usr/lib/qt4/mkspecs/qws/linux-arm-g++
针对x86-linux平台 export
QMAKESPEC=/usr/lib/qt4/mkspecs/qws/linux-g++-32或者如下图直接指定配置文件
-
3.QPainter::setPen: Painter not active
-
在画图设置画笔时显示如上错误,原因是QPainter对象还未激活,使用begin方法激活就可以了。帮助文档中有说明如下:
The isActive() function indicates whether the painter is active. A painter is activated by the begin() function and the constructor that takes a QPaintDevice argument. The end() function, and the destructor, deactivates it.
要么用begin()方法,要么在构造函数时赋一个绘图设备参数给QPainter才能active它。