Important: Please read the Qt Code of Conduct -

Using FMod library with Qt Creator crashes the program.

  • The same error in this post occurs . It seems that it can not find corresponding lib.

    QT       += core gui widgets
    TARGET = fmod
    TEMPLATE = app
    CONFIG += c++11
    SOURCES += \
            main.cpp \
    HEADERS += \
    FORMS += \
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    INCLUDEPATH += "D:/FMOD Studio API Windows/api/lowlevel/inc"
    LIBS += D:\FMOD Studio API Windows\api\lowlevel\lib\fmod.dll

    This is my pro file. I'm using minGW as compiler.

    The fmod.dll file do exist.

    I found that it does not crash if I execute the result executable file directly. (Maybe this is because I added the lib path to system path).

    It doesn't crash if I put the fmod.dll in the directory where result exectuable file is. Why does this happen? I can't understand why it can not find a dll file even though I specify the path of it.

  • It works after I remove the path of lib from the system path. I have no idea what blocks the execution.

  • Lifetime Qt Champion

    Hi @Aaron-Kim,

    1. if you use paths with spaces or non-ASCII chars in it, you can expect trouble everywhere. Please avoid this.
    2. The libs lines should be something like:
      LIBS += -LD:/FMOD Studio API Windows/api/lowlevel/lib -lfmod

    Note the forward slashes, the "-L" for the path and the "-l" for the linker include, not for the DLL!

    And please, please rename FMOD Studio API Windows to something without spaces (e.g. FMOD_Studio_API_Windows).


  • @aha_1980 Thanks! It works. Do you mind if I ask the difference between

    LIBS += -LD:/FMOD Studio API Windows/api/lowlevel/lib -lfmod


    LIBS += D:/FMOD Studio API Windows/api/lowlevel/lib/fmod.dll


  • Lifetime Qt Champion


    In the first one, you tell the linker where it can find the .lib file (either a static or import library) and the name of the library you want to link to.

    The second line you just add the path to a .dll file which won't help because the linker don't know what to do with that kind of input.

Log in to reply