Important: Please read the Qt Code of Conduct -

Trouble with libraries built outside of Qt Creator

  • Hello,

    I have built my first app and am having some trouble. My app lets you browse for a file and then it does all sorts of magic after you select the file. I have several massive static libraries (about 4 gigs worth) that were built using Visual Studio 2013 that I am trying to use in my Qt project. It is not really feasible to try to rebuild this libraries in Qt Creator or add them in any way to my project.

    Everything runs perfectly fine in Qt Creator. I then used the windows deployment tool and got all the DLLs and the executable ran perfectly fine once again.

    But I absolutely must have (I am determined!) a single standalone executable. So I build static Qt and everything goes fine. I go to build the standalone executable and it appears to work fine even on a computer without Qt, I can open the app and it starts out good and I can browse for files. But as soon as I select a file and my library magic is about to happen, the program crashes!! I have static and dynamic versions of my libraries and I am using the correct versions! It has to be the way I am linking these, it has to be ultra simple but I can't figure it out!

    Here's my file:

    RC_FILE = myapp.rc
    Target = Test
    Template = app
    #just the sources in my project
    SOURCES += main.cpp\
    #just the headers in my project
    CONFIG += static
    FORMS +=mainwindow.ui
    #W is a mapped drive
    #W:/include is where my library headers "magic*.h" are
    INCLUDEPATH+= W:/include
    #W:/lib is where my libraries "magic*.lib" files are
    LIBS+=-L./W:/lib/ -lmagic1
    LIBS+=-L./W:/lib/ -lmagic2
    LIBS+=-L./W:/lib/ -lmagic3
    LIBS+=-L./W:/lib/ -lmagic4
    LIBS+=-L./W:/lib/ -lmagic5
    LIBS+=-L./W:/lib/ -lmagic6

  • By the way, I configured using these options:

    configure -release -opensource -platform win32-msvc2013 -opengl desktop -static -nomake examples -nomake tests

    I only need release, I am not distributing this app so -opengl desktop is what I want. Please help if you can, thanks!

  • Moderators

    Hello @RandyH ,
    ./W:/lib/ isn't really a correct path, and the whole point of having separate paths passed to the linker is to save yourself some trouble of repeating them. The correct link line would look something like this:

    LIBS += -LW:/lib -lmagic1 -lmagic2 \
        -lmagic3 -lmagic4

    Hope that helps.
    Kind regards.

Log in to reply