Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED] dependent project seems to be only partially linking with its dependency

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

Scheduled Pinned Locked Moved Qt Creator and other tools
2 Posts 1 Posters 1.2k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    Jesdisciple
    wrote on last edited by
    #1

    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
    }
    @

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jesdisciple
      wrote on last edited by
      #2

      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.

      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