Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. error: undefined symbol
QtWS25 Last Chance

error: undefined symbol

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
webassemblyqt 5.15.0emscriptenmingw 64 bit
2 Posts 1 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • RenioR Offline
    RenioR Offline
    Renio
    wrote on last edited by Renio
    #1

    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: _ZN7TinyLibD1Ev

    I 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.8

    my pro file is

    TestWidget.pro

    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
    
    1 Reply Last reply
    0
    • RenioR Offline
      RenioR Offline
      Renio
      wrote on last edited by
      #2

      after contact the qt support, they suggest me to replace

      win32: LIBS += -L$$PWD/../../TinyLib/build-TinyLib-Qt_5_15_0_WebAssembly-Debug/ -lTinyLib
      

      with

      wasm:LIBS += -L$$PWD/../../TinyLib/build-TinyLib-Qt_5_15_0_WebAssembly-Debug/ -lTinyLib
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved