Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Linking to DLL (LNK1107)
Qt 6.11 is out! See what's new in the release blog

Linking to DLL (LNK1107)

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.7k Views 2 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.
  • L Offline
    L Offline
    Linhares
    wrote on last edited by
    #1

    I'm trying to use Fluidsynth in a 32-bit application with Qt 5.15, MSVC 2019.
    When I try to build, I get this error message:
    LNK1107: invalid or corrupt file: cannot read at 0x2F8

    I get this error for each one of the DLLs I'm trying to use.

    Am I missing something?

    Here's the .pro file:

    TEMPLATE = app
    CONFIG += console c++17
    CONFIG -= app_bundle
    CONFIG -= qt
    
    SOURCES += \
            main.cpp \
    
    HEADERS += \
        fluidsynth.h \
        fluidsynth/audio.h \
        fluidsynth/event.h \
        fluidsynth/gen.h \
        fluidsynth/ladspa.h \
        fluidsynth/log.h \
        fluidsynth/midi.h \
        fluidsynth/misc.h \
        fluidsynth/mod.h \
        fluidsynth/seq.h \
        fluidsynth/seqbind.h \
        fluidsynth/settings.h \
        fluidsynth/sfont.h \
        fluidsynth/shell.h \
        fluidsynth/synth.h \
        fluidsynth/types.h \
        fluidsynth/version.h \
        fluidsynth/voice.h
    
    
    win32: LIBS += -L$$PWD/Library/ -lfluidsynth
    
    INCLUDEPATH += $$PWD/fluidsynth.
    DEPENDPATH += $$PWD/fluidsynth.
    
    win32:!win32-g++: PRE_TARGETDEPS += $$PWD/Library/fluidsynth.lib
    else:win32-g++: PRE_TARGETDEPS += $$PWD/Library/libfluidsynth.a
    
    
    LIBS += $$PWD/bin/intl.dll
    LIBS += $$PWD/bin/libfluidsynth-3.dll
    LIBS += $$PWD/bin/libglib-2.0-0.dll
    LIBS += $$PWD/bin/libgobject-2.0-0.dll
    LIBS += $$PWD/bin/libgthread-2.0-0.dll
    LIBS += $$PWD/bin/libinstpatch-2.dll
    LIBS += $$PWD/bin/libsndfile-1.dll
    
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Linhares said in Linking to DLL (LNK1107):

      Fluidsynth

      Did you compile this Fluidsynth DLL yourself ?

      It must be created with vs 2017 or 2019 for it to work.

      1 Reply Last reply
      0
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        And you can't link against the DLLs but against the static import libs (.lib)

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        2
        • L Offline
          L Offline
          Linhares
          wrote on last edited by
          #4

          @mrjj
          I've downloaded the libraries (lib and dlls) from here: https://github.com/FluidSynth/fluidsynth/releases
          However, since I have to use a 32-bit compiler, I've downloaded the version fluidsynth-2.2.8-winXP-x86.zip. Is it possible that this version can only work with winXP and not with win10?

          @Christian-Ehrlicher
          I tried to link against the .lib alone, but I got an error (0xc000007b) that is usually related to trying to compile the wrong architecture.

          You may see from my answers that I am a noob. Maybe it's a silly question, but what would be the correct way of creating a lib? I've tried to create it from the source files, but it looks like fluidsyinth.h (the .h file that needs to be included) is not among the header files provided.

          mrjjM 1 Reply Last reply
          0
          • L Linhares

            @mrjj
            I've downloaded the libraries (lib and dlls) from here: https://github.com/FluidSynth/fluidsynth/releases
            However, since I have to use a 32-bit compiler, I've downloaded the version fluidsynth-2.2.8-winXP-x86.zip. Is it possible that this version can only work with winXP and not with win10?

            @Christian-Ehrlicher
            I tried to link against the .lib alone, but I got an error (0xc000007b) that is usually related to trying to compile the wrong architecture.

            You may see from my answers that I am a noob. Maybe it's a silly question, but what would be the correct way of creating a lib? I've tried to create it from the source files, but it looks like fluidsyinth.h (the .h file that needs to be included) is not among the header files provided.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Linhares

            Hi
            Yes, it's likely that fluidsynth-2.2.8-winXP-x86.zip was compiled with another version than VS 2017 and VS 2019, and then it won't work. It's not so much it's for win xp versus win 10 but about the compiler version used to create the included DLLs. To link the DLLS into your project, the compilers used has to be compatible.
            If possible just ask them what compiler was used.

            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