linking with MinGW g++ 64bit on win7


i read a lot postings regarding linking issues with mingw and also a lot of workarounds. But the official statement is, that i should be able to use fmod also in mingw. I am using


What have i done to test this so far?

  1. I copied the play_stream.cpp, common.h and common_platform.h into a testfolder

  2. changed the function name to

    int main(int argc, char **argv)

  3. copied all .h and .hpp from the inc-folder to c:\fmod\inc

  4. copied fmod64.dll from the lib-folder to c:\fmod\lib

  5. created a make-file

INCLUDE_PATH = -Ic:/fmod/inc

LIBRARY_PATH = -Lc:/fmod/lib/

LIBS = -lfmod64

all: play_stream.cpp

g++ -std=c++11 play_stream.cpp -o play_stream $(INCLUDE_PATH) $(LIBRARY_PATH) $(LIBS)

But when i compile (and link) i get a lot of undefined reference like:

play_stream.cpp:(.text+0x31): undefined reference to `Common_Init(void**)'

play_stream.cpp:(.text+0x57): undefined reference to `ERRCHECK_fn(FMOD_RESULT, char const*, int)'

play_stream.cpp:(.text+0x67): undefined reference to `FMOD::System::getVersion(unsigned int*)'

play_stream.cpp:(.text+0x81): undefined reference to `ERRCHECK_fn(FMOD_RESULT, char const*, int)'

play_stream.cpp:(.text+0xa2): undefined reference to `Common_Fatal(char const*, ...)'

play_stream.cpp:(.text+0xc0): undefined reference to `FMOD::System::init(int, unsigned int, void*)'

play_stream.cpp:(.text+0xda): undefined reference to `ERRCHECK_fn(FMOD_RESULT, char const*, int)'

play_stream.cpp:(.text+0xe6): undefined reference to `Common_MediaPath(char const*)'

You need to compile and link in common.cpp and common_platform.cpp

1 Like

cool, at least that reduced the amount of errors. stupid me that i forgot the cpp´s. All “Common_…” and “ERRCHECK_…” are fixed now.

But what is still left are 16 undefined references to “FMOD::System”, “FMOD::Sound” and “FMOD::ChannelControl”. Any idea what i am doing wrong?

oh, and btw: I changed the name of “my” init back to “FMOD_Main()”, so it is back to the original “play_stream.cpp”

Hello, i have exactly the same issue with undefined references, is fmod 64 bits compatible with mingw in windows?

The C API of the supplied libraries are compatible with MinGW (C++ ABI not supported). The 64 bit dll can be linked directly. You will need to use the import library libfmod.a and libfmodstudio.a in order to link the 32 bit dlls.