编译qt/e自带的例子,比如aclock,会出现问题:
...
aclock.cpp: In member function `void AnalogClock::drawClock(QPainter*)':
aclock.cpp:83: no matching function for call to `QPainter::setWindow(int, int,
int, int)'
aclock.cpp:85: no matching function for call to `QPainter::viewport()'
aclock.cpp:88: no matching function for call to `QPainter::setViewport(int,
int, int&, int&)'
aclock.cpp:94: no matching function for call to `QPainter::rotate(int)'
aclock.cpp:100: no matching function for call to `QPainter::rotate(int)'
aclock.cpp:107: no matching function for call to `QPainter::rotate(int)'
...
我到$QTDIR/include下查看qpainter.h,发现setWindow函数的声明是用#ifndef QT_NO_TRANSFORMATIONS包含起来的, 说明在配置使用都config里定义了这个宏, 所以这些函数都没编进qte。
解决办法:
在$QTDIR/src/tools目录下,找到配置使用都config文件,我这里是qconfig_qpe.h,注释掉QT_NO_TRANSFORMATIONS的定义,然后重新编译qte,会在lib下重新生成libqte.so,这时例程就可以编译了。