Linking to DLL (LNK1107)
-
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 0x2F8I 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 -
@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.
-
And you can't link against the DLLs but against the static import libs (.lib)
-
@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.
-
@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.
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.