Important: Please read the Qt Code of Conduct -

Trouble with a "Shared Library" from another project

  • Hi everyone,

    I'm trying to use a methode from another subproject from my qt project.

    For the Subproject, I use "TEMPLATE = lib" and "DEFINES += MYSHAREDLIB_LIBRARY". The Methode is marked for export like in "":

    There is no error on build process, but while runtime the programm crashed an I get this message:

    @mainwindow: symbol lookup error: @
    and undefined symbol: _ZN11ErrorWidgetC1E7QString@

    Is there anyone who knows how to fix this problem? Im thankful for every advice.

    Best greetings,

  • Oh sorry,

    my configuration is:

    OS: Debian Lenny

    Qt: 4.6

    Qt Creator: 2.0

    Best greetings,

  • First, check whether the symbol is in the exported section of

    nm -D | grep _ZN11ErrorWidgetC1E7QString

    If it's not there, make sure that you link the *.o file where it's declared into your lib. You can check in which *.o file your symbol ends up by using nm on all *.o files, e.g.

    find . -name "*.o" | xargs nm -o | grep _ZN11ErrorWidgetC1E7QString

  • Hi.

    thanks for your reply.

    You are right, the Command
    @nm -D | grep _ZN11ErrorWidgetC1E7QString@

    doesn't return anything. So I tried to link the correct object file "errorwidget.o":

    @OBJECTS += [...]errorwidget.o@

    But while runtime the program crashed and the same errormessage raises:

    @undefined symbol: _ZN11ErrorWidgetC1E7QString@

    Best greetings,

  • [quote author="haller" date="1279789507"]Hi.
    @OBJECTS += [...]errorwidget.o@

    Instead of adding the object file to OBJECTS, I suggest adding errorwidget.cpp to SOURCES...

  • Whooohoo. That works :-) Thanks a lot.

Log in to reply