cancel
Showing results for 
Search instead for 
Did you mean: 

library link error in Qt

LeonSu
Associate

Hello,

Do I need to change the version of STM32CubeProgrammer, or is it just an incorrect setting in the .pro file? Please help me fix it. Thank you in advance.

//----------------------------------------------------------------------------------------------------

Environment

ubuntu 22.04
Qt 6.5.3
qmake version 3.1
STM32CubeProgrammer 2.18.0
gcc version 11.4.0

//--------------------------------------------------------------------------------------------------------

qt pro file

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17
#DEFINES += QT_NO_VERSION_TAGGING

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
main.cpp \
mainwindow.cpp \
stm32downloader.cpp \
upgradeFirmware.cpp

HEADERS += \
mainwindow.h \
stm32downloader.h

FORMS += \
mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

API_PATH = "/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer"

INCLUDEPATH += $$API_PATH/api/include
DEPENDPATH += $$API_PATH/api/src

DESTDIR = += $$API_PATH/bin
LIBS += -L"/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/lib" -lCubeProgrammer_API

RESOURCES += \
icon.qrc

//--------------------------------------------------------------------------------------------------------
The error message from QT

:-1: error: /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/lib/libCubeProgrammer_API.so: undefined reference to `qt_version_tag@Qt_6.6'
:-1: error: /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/lib/libCubeProgrammer_API.so: undefined reference to `QString::toUcs4_helper(char16_t const*, long long, char32_t*)@Qt_6'
:-1: error: collect2: error: ld returned 1 exit status
:-1: error: [Makefile:371: +=/stm32FirmwareUpgrade] Error 1

//-------------------------------------------------------------------------------------------------------
0 REPLIES 0