【问题标题】:Qt5 undefined reference to `QStringQt5未定义对`QString的引用
【发布时间】:2017-11-21 23:26:41
【问题描述】:

我在他们的 SDK 中有一个传感器,他们正在调用 QT5 包。

这是构建程序的GCC命令gcc Main.c -o main -L../../Release -L/usr/lib/arm-linux-gnueabihf -lQt5SerialPort -lLeddarC -lLeddar -lLeddarTech -lstdc++

但在那之后我收到了这些错误:

../../Release/libLeddar.so: undefined reference to `QString::toLocal8Bit_helper(QChar const*, int)'
../../Release/libLeddarC.so: undefined reference to `QString::toUtf8_helper(QString const&)'
../../Release/libLeddarC.so: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'

我认为 Qstring 是 QtCore 的一部分,我厌倦了将其添加到 gcc 但我只是找到了基本上基于 Qt4 而不是 5 的 /usr/lib/arm-linux-gnueabihf/libQtCore.so.4

我已经在/usr/lib/arm-linux-gnueabihf 找到了Qt5SerialPort 的位置。但我不知道为什么我收到QString 的错误 你能帮我解决这个问题吗?

当我寻找 QString 时,我得到了这个:

/usr/include/qt5/QtCore/QStringRef
/usr/include/qt5/QtCore/QStringData
/usr/include/qt5/QtCore/QStringBuilder
/usr/include/qt5/QtCore/QStringMatcher
/usr/include/qt5/QtCore/QStringList
/usr/include/qt5/QtCore/QStringListModel
/usr/include/qt5/QtCore/QStringDataPtr
/usr/include/qt5/QtCore/QString
/usr/include/qt5/QtCore/QStringListIterator

它们似乎在包含文件夹中,但我不知道如何使用 GCC 调用它们,因为它们不是构建 *.so 库。

【问题讨论】:

    标签: gcc qt5 qstring


    【解决方案1】:

    认为您需要在 gcc 命令中添加新的 -lQtCore 选项。

    【讨论】:

    • 问题是我无法在我的系统上找到 libQtcore.so 以先用 -L 解决它,然后用 -l 调用它
    • 那么你需要安装或构建一组合适的 Qt 库。
    • 我可以知道如何安装 QtCore 吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多