LLRP 与 QT 的集成给出错误 "Skipping incompatible /path/libltkcpp.a when searching for -lltkcpp"

LLRP integration with QT giving error "Skipping incompatible /path/libltkcpp.a when searching for -lltkcpp"

我正在使用 C++ 在 QT Creator 上编写应用程序以通过 LLRP 协议读取 RFID 标签。

我正在使用 llrp.org 站点中提供的 example.cpp,在尝试编译代码时抛出以下错误 -

:-1: error: /home/project/RFID/lib/libltkcpp.a: Timestamp out of range; substituting 1970-01-01 05:30:00
:-1: error: skipping incompatible /home/project/RFID/lib//libltkcpp.a when searching for -lltkcpp
:-1: error: cannot find -lltkcpp
:-1: error: skipping incompatible /home/project/RFID/lib//libxml2.a when searching for -lxml2
:-1: error: collect2: error: ld returned 1 exit status

我已将库 - libltkcpp.a、libltkcpp_r.lib、libxml2.a 添加到我的项目中。问题还是来了。知道这里出了什么问题吗?

开发环境为64位CentOS

首先,您需要一个如下所示的 pro 文件:

CONFIG -= qt
CONFIG -= app_bundle

SOURCES += \
    /some-path-to-the-example/example1.cpp

LIBS += -L/some-path-to-the-libraries -lltkcpp -lxml2
INCLUDEPATH  += /some-path-to-the-library-headers

然后,要么在使用 linux-g++-32 作为 Qt mkspec 的地方制作一个新的 Qt Creator Kit,并配置项目以使用它;

或者,作为替代方案,使用现有工具包,但在项目构建步骤中添加 -spec linux-g++-32 作为 qmake 的附加参数。

运行 qmake、重建和链接器问题应该消失了。

然而,您可能会遇到一些编译器抱怨缺少 headers,在这种情况下,您很可能需要安装 32 位开发库。

在 Ubuntu,安装 gcc-7-multilibg++-7-multilib 软件包的任务已完成。

关于CentOS,我真的不是很清楚。希望this red hat related post能帮到你。