当前位置:   article > 正文

arm-linux-gnueabihf-gcc 5.2编译qt4.8.5_dialogs/qprintdialog_unix.cpp:281:19: error: 鈥榗las

dialogs/qprintdialog_unix.cpp:281:19: error: 鈥榗lass ui::qprintpropertieswid

1、解压

tar xzvf qt-everywhere-opensource-src-4.8.5.tar.gz

2、 修改 qmake.conf

mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf 

  1. #
  2. # qmake configuration for building with arm-none-linux-gnueabi-g++
  3. #
  4. include(../../common/linux.conf)
  5. include(../../common/gcc-base-unix.conf)
  6. include(../../common/g++-unix.conf)
  7. include(../../common/qws.conf)
  8. QMAKE_LIBS_EGL += -lEGL
  9. QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL
  10. QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lGAL
  11. IMX6_CFLAGS = -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1
  12. QMAKE_CFLAGS += $$IMX6_CFLAGS
  13. QMAKE_CXXFLAGS += $$IMX6_CFLAGS
  14. DISTRO_OPTS += hard-float
  15. # modifications to g++.conf
  16. QMAKE_CC = /opt/arm-5.2/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -lts
  17. QMAKE_CXX = /opt/arm-5.2/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -lts
  18. QMAKE_LINK = /opt/arm-5.2/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -lts
  19. QMAKE_LINK_SHLIB = /opt/arm-5.2/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -lts
  20. # modifications to linux.conf
  21. QMAKE_AR = /opt/arm-5.2/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ar cqs
  22. QMAKE_OBJCOPY = /opt/arm-5.2/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-objcopy
  23. QMAKE_STRIP = /opt/arm-5.2/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip
  24. load(qt_config)

3.配置编译项 configure

  1. #!/bin/bash
  2. ./configure -prefix /usr/local/Trolltech/Qt-4.8.5 \
  3. -opensource \
  4. -confirm-license \
  5. -device-option CROSS_COMPILE=/opt/arm-5.2/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- \
  6. -release -shared \
  7. -embedded arm \
  8. -xplatform qws/linux-arm-gnueabi-g++ \
  9. -fast \
  10. -optimized-qmake \
  11. -no-pch \
  12. -qt-libjpeg \
  13. -qt-zlib \
  14. -qt-libpng \
  15. -qt-freetype \
  16. -little-endian \
  17. -host-little-endian \
  18. -no-qt3support \
  19. -no-libtiff \
  20. -no-libmng \
  21. -no-opengl \
  22. -no-mmx \
  23. -no-sse \
  24. -no-sse2 \
  25. -no-3dnow \
  26. -no-openssl \
  27. -no-webkit \
  28. -no-qvfb \
  29. -no-phonon \
  30. -no-nis \
  31. -no-cups \
  32. -no-glib \
  33. -qt-mouse-tslib \
  34. -nomake tools \
  35. -nomake docs \
  36. -nomake examples \
  37. -qt-sql-sqlite \
  38. -plugin-sql-sqlite \
  39. -rpath \
  40. -v \
  41. -I/home/lyp/workspace/qt/arm-tslib/include \
  42. -L/home/lyp/workspace/qt/arm-tslib/lib

4.编译及安装

make

sudo make install

遇到问题

 -I../../include/QtCore -I../../include/QtNetwork -I../../include -I../../include/QtGui -I.rcc/release-shared-emb-arm -Iimage -I../3rdparty/libpng -I../3rdparty/zlib -I../3rdparty/zlib -I../3rdparty/freetype/builds/unix -I../3rdparty/freetype/src -I../3rdparty/freetype/include -I../3rdparty/harfbuzz/src -Idialogs -I.moc/release-shared-emb-arm -I.uic/release-shared-emb-arm -o .obj/release-shared-emb-arm/qprintdialog_unix.o dialogs/qprintdialog_unix.cpp
dialogs/qprintdialog_unix.cpp: In destructor 'virtual QPrintPropertiesDialog::~QPrintPropertiesDialog()':
dialogs/qprintdialog_unix.cpp:281:19: error: 'class Ui::QPrintPropertiesWidget' has no member named 'cupsPropertiesPage'
     delete widget.cupsPropertiesPage;
                   ^
dialogs/qprintdialog_unix.cpp: In member function 'void QPrintPropertiesDialog::applyPrinterProperties(QPrinter*)':
dialogs/qprintdialog_unix.cpp:287:12: error: 'class Ui::QPrintPropertiesWidget' has no member named 'pageSetup'
     widget.pageSetup->setPrinter(p);
            ^
dialogs/qprintdialog_unix.cpp: In member function 'void QPrintPropertiesDialog::setupPrinter() const':
dialogs/qprintdialog_unix.cpp:292:12: error: 'const class Ui::QPrintPropertiesWidget' has no member named 'pageSetup'
     widget.pageSetup->setupPrinter();
            ^
dialogs/qprintdialog_unix.cpp: In member function 'void QPrintPropertiesDialog::selectPrinter()':
dialogs/qprintdialog_unix.cpp:337:16: error: 'class Ui::QPrintPropertiesWidget' has no member named 'cupsPropertiesPage'
         widget.cupsPropertiesPage->setEnabled(false);
                ^
dialogs/qprintdialog_unix.cpp:338:16: error: 'class Ui::QPrintPropertiesWidget' has no member named 'pageSetup'
         widget.pageSetup->selectPrinter(0);
                ^
dialogs/qprintdialog_unix.cpp: In member function 'void QPrintPropertiesDialog::selectPdfPsPrinter(const QPrinter*)':
dialogs/qprintdialog_unix.cpp:345:12: error: 'class Ui::QPrintPropertiesWidget' has no member named 'pageSetup'
     widget.pageSetup->selectPdfPsPrinter(p);
            ^
dialogs/qprintdialog_unix.cpp:346:12: error: 'class Ui::QPrintPropertiesWidget' has no member named 'tabs'
     widget.tabs->setTabEnabled(1, false); // disable the advanced tab
            ^
dialogs/qprintdialog_unix.cpp: In member function 'void QPrintDialogPrivate::init()':
dialogs/qprintdialog_unix.cpp:389:13: error: 'class Ui::QPrintSettingsOutput' has no member named 'color'
     options.color->setIconSize(QSize(32, 32));
             ^
dialogs/qprintdialog_unix.cpp:390:13: error: 'class Ui::QPrintSettingsOutput' has no member named 'color'
     options.color->setIcon(QIcon(QLatin1String(":/trolltech/dialogs/qprintdialog/images/status-color.png")));
             ^
dialogs/qprintdialog_unix.cpp:391:13: error: 'class Ui::QPrintSettingsOutput' has no member named 'grayscale'
     options.grayscale->setIconSize(QSize(32, 32));
             ^
dialogs/qprintdialog_unix.cpp:392:13: error: 'class Ui::QPrintSettingsOutput' has no member named 'grayscale'
     options.grayscale->setIcon(QIcon(QLatin1String(":/trolltech/dialogs/qprintdialog/images/status-gray-scale.png")));
             ^
dialogs/qprintdialog_unix.cpp:421:30: error: 'class Ui::QPrintSettingsOutput' has no member named 'reverse'
     QObject::connect(options.reverse, SIGNAL(toggled(bool)),
                              ^
dialogs/qprintdialog_unix.cpp: In member function 'void QPrintDialogPrivate::applyPrinterProperties(QPrinter*)':
dialogs/qprintdialog_unix.cpp:430:17: error: 'class Ui::QPrintSettingsOutput' has no member named 'color'
         options.color->setChecked(true);
                 ^
dialogs/qprintdialog_unix.cpp:432:17: error: 'class Ui::QPrintSettingsOutput' has no member named 'grayscale'
         options.grayscale->setChecked(true);
                 ^
dialogs/qprintdialog_unix.cpp:436:17: error: 'class Ui::QPrintSettingsOutput' has no member named 'noDuplex'
         options.noDuplex->setChecked(true); break;
                 ^
dialogs/qprintdialog_unix.cpp:439:17: error: 'class Ui::QPrintSettingsOutput' has no member named 'duplexLong'
         options.duplexLong->setChecked(true); break;
                 ^
dialogs/qprintdialog_unix.cpp:441:17: error: 'class Ui::QPrintSettingsOutput' has no member named 'duplexShort'
         options.duplexShort->setChecked(true); break;
                 ^
dialogs/qprintdialog_unix.cpp:443:13: error: 'class Ui::QPrintSettingsOutput' has no member named 'copies'
     options.copies->setValue(p->copyCount());
             ^
dialogs/qprintdialog_unix.cpp:444:13: error: 'class Ui::QPrintSettingsOutput' has no member named 'collate'
     options.collate->setChecked(p->collateCopies());
             ^
dialogs/qprintdialog_unix.cpp:445:13: error: 'class Ui::QPrintSettingsOutput' has no member named 'reverse'
     options.reverse->setChecked(p->pageOrder() == QPrinter::LastPageFirst);
             ^
dialogs/qprintdialog_unix.cpp: In member function 'void QPrintDialogPrivate::setupPrinter()':
dialogs/qprintdialog_unix.cpp:490:17: error: 'class Ui::QPrintSettingsOutput' has no member named 'duplex'
     if (options.duplex->isEnabled()) {
                 ^
dialogs/qprintdialog_unix.cpp:491:21: error: 'class Ui::QPrintSettingsOutput' has no member named 'noDuplex'
         if (options.noDuplex->isChecked())
                     ^
 

在ubuntu20中遇到了该问题,换了 ubuntu14就可以了

ubuntu20上的解决方案

以上错误显然是环境问题造成。

根据错误提示:

dialogs/qprintdialog_unix.cpp:281:19: error: 'class Ui::QPrintPropertiesWidget' has no member named 'cupsPropertiesPage'

打开文件dialogs/qprintdialog_unix.cpp

搜索 cupsPropertiesPage

 

 找到这两个地方有调用到

可以看到跟QT_NO_CUPS 有关

配置选项带有-no-cups

 从代码中可以分析倒不是这句引起的,需要往上找widget的类型

 

 ui文件中有包含cupsPropertiesPage成员,为啥会提示没有?难道没有编译ui文件?难道跟make工具有关?换了下make3.8.1的后问题依然存在。

那是什么原因导致ui文件没成功被编译的?

Ubuntu20 交叉编译 Qt4.8 报错处理__圣_的博客-CSDN博客_ubuntu交叉编译qt

QT设计器设计的窗口部件,通过 uic 工具转换成C++代码。

用qt5.12.10带的uic替换后出现新的错误

 使用旧版gcc

1、安装gcc7并切换版本,使用update-alternatives进行版本切换,输入以下命令:

  1. sudo apt-get install gcc-7 g++-7
  2. # update-alternatives: --install 需要 <链接> <名称> <路径> <优先级>
  3. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100
  4. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 50
  5. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 100
  6. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 50

查看gcc的默认版本,可以看到当前默认gcc版本为7,即切换成功。

sudo update-alternatives --config gcc

 查看当前gcc命令的软链接

  1. ls -liat /usr/bin/gcc
  2. ls -liat /usr/bin/g++

重新配置和编译qt

问题2

lib/libQtGui.so: undefined reference to `ts_read_raw'

/lib/libQtGui.so: undefined reference to `ts_open'

/lib/libQtGui.so: undefined reference to `ts_fd'

/lib/libQtGui.so: undefined reference to `ts_config'

/lib/libQtGui.so: undefined reference to `ts_close'

/lib/libQtGui.so: undefined reference to `ts_read

解决办法:

/qmake.conf 文件(添加lts参数):

QMAKE_CC                = arm-linux-gcc -lts

QMAKE_CXX               = arm-linux-g++ -lts

QMAKE_LINK              = arm-linux-g++ -lts

QMAKE_LINK_SHLIB        = arm-linux-g++ -lts

arm编译QT4.8.5时出现lib/libQtGui.so: undefined reference to `ts_read_raw'的解决办法_navy电子爱好者的博客-CSDN博客

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/201132
推荐阅读
相关标签
  

闽ICP备14008679号