[SOLVED] dependent project seems to be only partially linking with its dependency



  • I have a library project and an application project, and the application is configured with the library as an external dependency. They seemed to be working fine together until I tried to extend a library class in the application. The linker complains that the library class's constructor symbol is not found.

    In the file that contains the parent class, I wrote a class extending it and calling its constructor. I moved this test class outside my library's namespace just to be sure, and it works. Of course the linker doesn't have a problem with file-internal references, but I wanted to be sure nothing more fundamental was wrong. And anyhow I'm not sure what test I could perform between these cases.

    I can pare down my code for a minimal test case if necessary; I'll start on that after work if the issue isn't solved by then.

    EDIT: Ah, there's no question mark in this post... How can I get my projects to link properly?

    My .pro files:

    application (note that I modified the -automatically generated- uglier portion to add the library's source directory to the include path)
    @#-------------------------------------------------

    Project created by QtCreator 2013-05-25T08:57:00

    #-------------------------------------------------

    QT += core gui widgets

    TARGET = Pong
    TEMPLATE = app
    CONFIG += staticlib c++11

    SOURCES +=
    mainwindow.cpp
    main.cpp
    sprite.cpp

    HEADERS += mainwindow.h
    sprite.h

    FORMS += mainwindow.ui

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Qnity/build-Qnity-OS_X-Release/release/ -lQnity
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Qnity/build-Qnity-OS_X-Release/debug/ -lQnity
    else:unix: LIBS += -L$$PWD/../../Qnity/build-Qnity-OS_X-Release/ -lQnity

    INCLUDEPATH += $$PWD/../../Qnity/build-Qnity-OS_X-Release
    INCLUDEPATH += $$PWD/../../Qnity/Qnity
    DEPENDPATH += $$PWD/../../Qnity/build-Qnity-OS_X-Release

    win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../Qnity/build-Qnity-OS_X-Release/release/Qnity.lib
    else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../Qnity/build-Qnity-OS_X-Release/debug/Qnity.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../../Qnity/build-Qnity-OS_X-Release/libQnity.a
    @

    library
    @#-------------------------------------------------

    Project created by QtCreator 2013-05-24T05:02:43

    #-------------------------------------------------

    QT += widgets opengl

    TARGET = Qnity
    TEMPLATE = lib
    CONFIG += staticlib c++11

    QMAKE_CXXFLAGS = -std=gnu0x -stdlib=libc+

    SOURCES +=
    entity.cpp
    typed.cpp
    system.cpp
    entitymanager.cpp
    icomponent.cpp

    HEADERS += entity.h
    typed.h
    system.h
    entitymanager.h
    icomponent.h
    unix:!symbian {
    maemo5 {
    target.path = /opt/usr/lib
    } else {
    target.path = /usr/lib
    }
    INSTALLS += target
    }
    @



  • Sorry this is a bit late. The issue was purely a C++ one of not implementing a template class's constructor in the header file. Oops.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.