error: undefined symbol
-
Goodmorning everyone,
i am starting to work with webassembly.
I describe my problem:
I have created a simple static library (called TinyLib), and I want to use in my WebAssembly project.
TinyLib contains contructor, destructor and a numeric attribute.
The WebAssembly project (called TestWidget) is a simple dialog with a label inside where I write through the TinyLib library.
My intent is to write the value of attribute into label.
I tried to compile both projects as Desktop mode projects (Desktop Qt 5.15.0 MinGW 64-bit) with success.
I compiled TinyLib with Qt 5.15.0 WebAssembly and generate libTinyLib.a lib
I compiled TestWidget, alon and the project run!
Now if I try to compile both projects in WebAssembly mode (TestWidget use TinyLib), while compiling TestWidget, I get this error message:error: undefined symbol: _ZN7TinyLibC1Ev
warning: Link with-s LLD_REPORT_UNDEFINED
to get more information on undefined symbols
warning: To disable errors for undefined symbols use-s ERROR_ON_UNDEFINED_SYMBOLS = 0
error: undefined symbol: _ZN7TinyLibD1EvI tried to search on the web but without success.
In this forum I found the following thread:
https://forum.qt.io/topic/115660/add-static-library
but it didn't help me.Have you also had the same problem? And how did you solve it?
O.S. Windoows 10 Pro
Qt 5.15.0
EMCC 1.39.8my pro file is
QT += core gui greaterThan (QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c ++ 11 # 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 \ dialog.cpp HEADERS += \ dialog.h FORMS += \ dialog.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:! android: target.path = /opt/$${TARGET}/bin ! isEmpty (target.path): INSTALLS += target win32: LIBS += -L$$PWD/../../TinyLib/build-TinyLib-Qt_5_15_0_WebAssembly-Debug/ -lTinyLib INCLUDEPATH += $$PWD/../../TinyLib/TinyLib DEPENDPATH + = $$PWD/../../TinyLib/TinyLib