Linking to FMOD Studio using MinGW

Hi,

I’m having troubles linking my application to FMOD Studio API using MinGW. I’m trying to link against fmodstudio.dll, but keep getting undefined reference errors to the functions that I’m trying to use.

I’ve managed to link against the lowlevel API without problems (and gotten sounds to play this way).

Has anyone gotten MinGW to work with the latest (1.03.07) Studio API?

This is my CMake output:
sound\libsound.a(sound_system.cpp.obj):sound_system.cpp:(.text+0x408): undefined reference to FMOD_Studio_System_Create@8' sound\libsound.a(sound_system.cpp.obj):sound_system.cpp:(.text+0x440): undefined reference toFMOD_Studio_System_Initialize@20’

and output from make VERBOSE=1:

c:\MinGW\bin\g++.exe -std=c++11 -Wall -Wconversion -Werror -Wno-unused-local-typedefs -Wl,–enable-stdcall-fixup -Wl,–whole-archive CMakeFiles\office_revenge.dir/objects.a -Wl,–no-whole-archive -o …\bin\office_revenge.exe -Wl,–out-implib,liboffice_revenge.dll.a -Wl,–major-image-version,0,–minor-image-version,0 sound\libsound.a -lmingw32 -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid D:\code\lib\SFML-2.1\lib\libsfml-system.a D:\code\lib\SFML-2.1\lib\libsfml-window.a D:\code\lib\SFML-2.1\lib\libsfml-graphics.a …\src…\lib\LuaJIT-2.0.3\bin\lua51.dll D:\code\lib\boost_1_55_0\stage\lib\libboost_system-mgw48-mt-1_55.a D:\code\lib\boost_1_55_0\stage\lib\libboost_filesystem-mgw48-mt-1_55.a D:\code\lib\boost_1_55_0\stage\lib\libboost_unit_test_framework-mgw48-mt-1_55.a “c:\Program Files (x86)\FMOD SoundSystem\FMOD Studio
API Windows\api\studio\lib\fmodstudio.dll” -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
sound\libsound.a(sound_system.cpp.obj):sound_system.cpp:(.text+0x408): undefined reference to FMOD_Studio_System_Create@8' sound\libsound.a(sound_system.cpp.obj):sound_system.cpp:(.text+0x440): undefined reference toFMOD_Studio_System_Initialize@20’

Regards

Check out a previous post I made for a little bit of a start: viewtopic.php?f=21&t=18762

But my issue was eventually resolved via direct email support with FMOD. FMOD told me that they are aware of the issue and intend to release MinGW compatible binaries on Windows as of version 1.04.

The gist of the issue is that FMOD Studio library does not yet currently export the dll symbols. You can actually generate a MinGW compatible binary with the following def:

EXPORTS
FMOD_Studio_ParseID@8
FMOD_Studio_System_Create@8
FMOD_Studio_System_SetAdvancedSettings@8
FMOD_Studio_System_GetAdvancedSettings@8
FMOD_Studio_System_Initialize@20
FMOD_Studio_System_Release@4
FMOD_Studio_System_Update@4
FMOD_Studio_System_GetLowLevelSystem@8
FMOD_Studio_System_GetEvent@16
FMOD_Studio_System_GetMixerStrip@16
FMOD_Studio_System_GetBank@12
FMOD_Studio_System_LookupID@12
FMOD_Studio_System_LookupPath@20
FMOD_Studio_System_GetListenerAttributes@8
FMOD_Studio_System_SetListenerAttributes@8
FMOD_Studio_System_LoadBankFile@16
FMOD_Studio_System_LoadBankMemory@24
FMOD_Studio_System_LoadBankCustom@16
FMOD_Studio_System_RegisterPlugin@8
FMOD_Studio_System_UnregisterPlugin@8
FMOD_Studio_System_UnloadAll@4
FMOD_Studio_System_FlushCommands@4
FMOD_Studio_System_StartRecordCommands@12
FMOD_Studio_System_StopRecordCommands@4
FMOD_Studio_System_PlaybackCommands@8
FMOD_Studio_System_GetBankCount@8
FMOD_Studio_System_GetBankList@16
FMOD_Studio_System_GetCPUUsage@8
FMOD_Studio_System_GetBufferUsage@8
FMOD_Studio_System_ResetBufferUsage@4
FMOD_Studio_EventDescription_GetID@8
FMOD_Studio_EventDescription_GetPath@16
FMOD_Studio_EventDescription_GetParameterCount@8
FMOD_Studio_EventDescription_GetParameterByIndex@12
FMOD_Studio_EventDescription_GetParameter@12
FMOD_Studio_EventDescription_GetUserPropertyCount@8
FMOD_Studio_EventDescription_GetUserPropertyByIndex@12
FMOD_Studio_EventDescription_GetUserProperty@12
FMOD_Studio_EventDescription_GetLength@8
FMOD_Studio_EventDescription_GetMinimumDistance@8
FMOD_Studio_EventDescription_GetMaximumDistance@8
FMOD_Studio_EventDescription_IsOneshot@8
FMOD_Studio_EventDescription_IsStream@8
FMOD_Studio_EventDescription_Is3D@8
FMOD_Studio_EventDescription_CreateInstance@8
FMOD_Studio_EventDescription_GetInstanceCount@8
FMOD_Studio_EventDescription_GetInstanceList@16
FMOD_Studio_EventDescription_LoadSampleData@4
FMOD_Studio_EventDescription_UnloadSampleData@4
FMOD_Studio_EventDescription_GetSampleLoadingState@8
FMOD_Studio_EventDescription_ReleaseAllInstances@4
FMOD_Studio_EventDescription_SetCallback@8
FMOD_Studio_EventDescription_GetUserData@8
FMOD_Studio_EventDescription_SetUserData@8
FMOD_Studio_EventInstance_GetDescription@8
FMOD_Studio_EventInstance_GetVolume@8
FMOD_Studio_EventInstance_SetVolume@8
FMOD_Studio_EventInstance_GetPitch@8
FMOD_Studio_EventInstance_SetPitch@8
FMOD_Studio_EventInstance_Get3DAttributes@8
FMOD_Studio_EventInstance_Set3DAttributes@8
FMOD_Studio_EventInstance_GetPaused@8
FMOD_Studio_EventInstance_SetPaused@8
FMOD_Studio_EventInstance_Start@4
FMOD_Studio_EventInstance_Stop@8
FMOD_Studio_EventInstance_GetTimelinePosition@8
FMOD_Studio_EventInstance_SetTimelinePosition@8
FMOD_Studio_EventInstance_GetPlaybackState@8
FMOD_Studio_EventInstance_GetChannelGroup@8
FMOD_Studio_EventInstance_Release@4
FMOD_Studio_EventInstance_IsVirtual@8
FMOD_Studio_EventInstance_GetParameter@12
FMOD_Studio_EventInstance_GetParameterByIndex@12
FMOD_Studio_EventInstance_GetParameterCount@8
FMOD_Studio_EventInstance_SetParameterValue@12
FMOD_Studio_EventInstance_SetParameterValueByIndex@12
FMOD_Studio_EventInstance_GetCue@12
FMOD_Studio_EventInstance_GetCueByIndex@12
FMOD_Studio_EventInstance_GetCueCount@8
FMOD_Studio_EventInstance_CreateSubEvent@12
FMOD_Studio_EventInstance_GetLoadingState@8
FMOD_Studio_EventInstance_SetCallback@8
FMOD_Studio_EventInstance_GetUserData@8
FMOD_Studio_EventInstance_SetUserData@8
FMOD_Studio_CueInstance_Trigger@4
FMOD_Studio_ParameterInstance_GetDescription@8
FMOD_Studio_ParameterInstance_GetValue@8
FMOD_Studio_ParameterInstance_SetValue@8
FMOD_Studio_MixerStrip_GetID@8
FMOD_Studio_MixerStrip_GetPath@16
FMOD_Studio_MixerStrip_GetFaderLevel@8
FMOD_Studio_MixerStrip_SetFaderLevel@8
FMOD_Studio_MixerStrip_GetPaused@8
FMOD_Studio_MixerStrip_SetPaused@8
FMOD_Studio_MixerStrip_GetMute@8
FMOD_Studio_MixerStrip_SetMute@8
FMOD_Studio_MixerStrip_StopAllEvents@8
FMOD_Studio_MixerStrip_GetChannelGroup@8
FMOD_Studio_MixerStrip_GetLoadingState@8
FMOD_Studio_MixerStrip_Release@4
FMOD_Studio_Bank_GetID@8
FMOD_Studio_Bank_GetPath@16
FMOD_Studio_Bank_Unload@4
FMOD_Studio_Bank_LoadSampleData@4
FMOD_Studio_Bank_UnloadSampleData@4
FMOD_Studio_Bank_GetLoadingState@8
FMOD_Studio_Bank_GetSampleLoadingState@8
FMOD_Studio_Bank_GetEventCount@8
FMOD_Studio_Bank_GetEventList@16
FMOD_Studio_Bank_GetMixerStripCount@8
FMOD_Studio_Bank_GetMixerStripList@16

This is the content of fmod_studio_cygwin.def (sorry, I had to throw it in as code since I can’t seem to upload any attachments). You can then generate a lib with the following command:

dlltool -U -d fmod_studio_cygwin.def -D fmodstudio.dll -l fmodstudio.a

fmodstudio.a will contain the dll import information for MinGW to use to properly link to the C version of the FMOD Studio API.

Special thanks to Graeme Webb, who figured this out and sent me the fix!

1 Like