gpt4 book ai didi

c++ - undefined reference EVP_sha1,HMAC,Id 返回 1 退出状态

转载 作者:行者123 更新时间:2023-11-30 03:43:29 27 4
gpt4 key购买 nike

我对上面的错误有疑问。在 m Code 中实现了 HMAC。我尝试通过此链接解决问题:Here

但它就是行不通,所以我希望你能帮助我。我真的坚持这个并玩了 QMAKE_CXXFLAGS 但没有得到积极的解决方案。

这是 .pro:

QT       += core gui webkit network

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = csui
TEMPLATE = app




#QMAKE_CFLAGS_RELEASE += -lssl -lcrypto
#QMAKE_CFLAGS_RELEASE += -lcrypto



target.path = /home/msw

INSTALLS += target

SOURCES += main.cpp\
mainwindow.cpp \
qcolpushbutton.cpp \
librfid/mifare.cpp \
librfid/list.cpp \
librfid/brp.cpp \
qrfid.cpp \
qscaledlabel.cpp \
statelogic.cpp \
qcsnp.cpp \
qchargepoint.cpp \
qi2cnode.cpp \
libhotp-tan.cpp

HEADERS += mainwindow.h \
qcolpushbutton.h \
debug.h \
config.h \
librfid/mifare.h \
librfid/list.h \
librfid/brp.h \
qrfid.h \
qscaledlabel.h \
statelogic.h \
qcsnp.h \
qchargepoint.h \
qi2cnode.h \
libhotp-tan.h

FORMS += mainwindow.ui

RESOURCES += \
res/res.qrc

以及 Makefile 中的链接

CFLAGS        = -pipe -isystem /home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/include -isystem /home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/include -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -isystem /home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/include -isystem /home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/include -O2 -Wall -W -D_REENTRANT $(DEFINES)

13:45:58: Führe Schritte für Projekt csui aus...
13:45:59: Starte "/opt/qt-4.8.3e-armhf/sysroot-cross/bin/qmake" '/home/msw/Arbeitsfläche/Experimentelles Programm/csui.pro' -r -spec /opt/qt-4.8.3e-armhf/sysroot-target/usr/mkspecs/qws/linux-ptx-g++
13:45:59: Der Prozess "/opt/qt-4.8.3e-armhf/sysroot-cross/bin/qmake" wurde normal beendet.
13:45:59: Starte "/usr/bin/make" -w
make: Entering directory `/home/msw/Arbeitsfläche/Experimentelles Programm'
arm-1136jfs-linux-gnueabihf-g++ -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib -Wl,-rpath-link -Wl,/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib -Wl,-rpath-link -Wl,/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib -Wl,-O1 -o csui main.o mainwindow.o qcolpushbutton.o mifare.o list.o brp.o qrfid.o qscaledlabel.o statelogic.o qcsnp.o qchargepoint.o qi2cnode.o libhotp-tan.o moc_mainwindow.o moc_qcolpushbutton.o moc_qrfid.o moc_qscaledlabel.o moc_statelogic.o moc_qcsnp.o moc_qchargepoint.o moc_qi2cnode.o qrc_res.o -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib -lQtWebKit -lQtGui -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib -L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib -lQtNetwork -lQtCore -lpthread
make: Leaving directory `/home/msw/Arbeitsfläche/Experimentelles Programm'
libhotp-tan.o: In function `hotpa(unsigned char const*, unsigned char const*, char*, unsigned int, unsigned char const*, unsigned int)':
libhotp-tan.cpp:(.text+0x74): undefined reference to `EVP_sha1'
libhotp-tan.cpp:(.text+0xb4): undefined reference to `HMAC'
collect2: error: ld returned 1 exit status
make: *** [csui] Error 1
13:46:01: Der Prozess "/usr/bin/make" wurde mit dem Rückgabewert 2 beendet.
Fehler beim Erstellen/Deployment des Projekts csui(Ziel: Embedded Linux)
Bei der Ausführung von Schritt 'Make'

谢谢!!

最佳答案

你的联动命令是:

arm-1136jfs-linux-gnueabihf-g++ \ 
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib \
-Wl,-rpath-link \
-Wl,/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib \
-Wl,-rpath-link \
-Wl,/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib \
-Wl,-O1 \
-o csui main.o mainwindow.o qcolpushbutton.o mifare.o list.o brp.o qrfid.o \
qscaledlabel.o statelogic.o qcsnp.o qchargepoint.o qi2cnode.o libhotp-tan.o \
moc_mainwindow.o moc_qcolpushbutton.o moc_qrfid.o moc_qscaledlabel.o moc_statelogic.o \
moc_qcsnp.o moc_qchargepoint.o moc_qi2cnode.o qrc_res.o \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib \
-lQtWebKit \
-lQtGui \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/usr/lib \
-L/home/msw/crossdev/OSELAS.BSP-RaspberryPi/platform-RaspberryPi/sysroot-target/lib \
-lQtNetwork \
-lQtCore \
-lpthread

(这里有很多多余的重复)

undefined symbol EVP_sha1HMAClibcrypto中定义,为此您还需要链接 libssl,但是 -lssl -lcrypto不在您传递给链接器的库选项中。您需要添加它们。

我不熟悉 QMake 但我相信库选项应该定义在 LIBS如果您生成链接器在 -lQtCore 之后使用 -lssl -lcrypto 的命令行你应该没问题。

我注意到 -lssl -lcrypto 出现在注释掉的设置中:

#QMAKE_CFLAGS_RELEASE += -lssl -lcrypto

那是行不通的,因为它正在为 C 编译器设置选项 Release模式,而不是链接器。同样 QMAKE_CXXFLAGS,你说你修补,为 C++ 编译器设置选项,而不是链接器。

关于c++ - undefined reference EVP_sha1,HMAC,Id 返回 1 退出状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36033980/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com