I’m having errors compiling FMOD under C++11(-std=c++0x). I’m at loss to why this is though, and what I can do to fix the problem.
I’m using the FMOD C library with GCC.

C:\FMOD\api\inc\fmod_codec.h|19|error: expected ‘)’ before ‘‘ token|
C:\FMOD\api\inc\fmod_codec.h|20|error: expected ‘)’ before ‘
‘ token|
C:\FMOD\api\inc\fmod_codec.h|21|error: expected ‘)’ before ‘‘ token|
C:\FMOD\api\inc\fmod_codec.h|22|error: expected ‘)’ before ‘
‘ token|
C:\FMOD\api\inc\fmod_codec.h|23|error: expected ‘)’ before ‘‘ token|
C:\FMOD\api\inc\fmod_codec.h|24|error: expected ‘)’ before ‘
‘ token|
C:\FMOD\api\inc\fmod_codec.h|25|error: expected ‘)’ before ‘‘ token|
C:\FMOD\api\inc\fmod_codec.h|26|error: expected ‘)’ before ‘
‘ token|
C:\FMOD\api\inc\fmod_codec.h|27|error: expected ‘)’ before ‘‘ token|
C:\FMOD\api\inc\fmod_codec.h|53|error: ‘FMOD_CODEC_OPENCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_codec.h|54|error: ‘FMOD_CODEC_CLOSECALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_codec.h|55|error: ‘FMOD_CODEC_READCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_codec.h|56|error: ‘FMOD_CODEC_GETLENGTHCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_codec.h|57|error: ‘FMOD_CODEC_SETPOSITIONCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_codec.h|58|error: ‘FMOD_CODEC_GETPOSITIONCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_codec.h|59|error: ‘FMOD_CODEC_SOUNDCREATECALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_codec.h|60|error: ‘FMOD_CODEC_GETWAVEFORMAT’ does not name a type|
C:\FMOD\api\inc\fmod_codec.h|154|error: ‘FMOD_CODEC_METADATACALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_dsp.h|21|error: expected ‘)’ before ‘
‘ token|
C:\FMOD\api\inc\fmod_dsp.h|22|error: expected ‘)’ before ‘‘ token|
C:\FMOD\api\inc\fmod_dsp.h|23|error: expected ‘)’ before ‘
‘ token|
C:\FMOD\api\inc\fmod_dsp.h|24|error: expected ‘)’ before ‘‘ token|
C:\FMOD\api\inc\fmod_dsp.h|25|error: expected ‘)’ before ‘
‘ token|
C:\FMOD\api\inc\fmod_dsp.h|26|error: expected ‘)’ before ‘‘ token|
C:\FMOD\api\inc\fmod_dsp.h|27|error: expected ‘)’ before ‘
‘ token|
C:\FMOD\api\inc\fmod_dsp.h|28|error: expected ‘)’ before ‘*’ token|
C:\FMOD\api\inc\fmod_dsp.h|131|error: ‘FMOD_DSP_CREATECALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_dsp.h|132|error: ‘FMOD_DSP_RELEASECALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_dsp.h|133|error: ‘FMOD_DSP_RESETCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_dsp.h|134|error: ‘FMOD_DSP_READCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_dsp.h|135|error: ‘FMOD_DSP_SETPOSITIONCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_dsp.h|139|error: ‘FMOD_DSP_SETPARAMCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_dsp.h|140|error: ‘FMOD_DSP_GETPARAMCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod_dsp.h|141|error: ‘FMOD_DSP_DIALOGCALLBACK’ does not name a type|
C:\FMOD\api\inc\fmod.h|1815|error: expected initializer before ‘FMOD_Memory_Initialize’|
C:\FMOD\api\inc\fmod.h|1816|error: expected initializer before ‘FMOD_Memory_GetStats’|
C:\FMOD\api\inc\fmod.h|1817|error: expected initializer before ‘FMOD_Debug_SetLevel’|
C:\FMOD\api\inc\fmod.h|1818|error: expected initializer before ‘FMOD_Debug_GetLevel’|
C:\FMOD\api\inc\fmod.h|1819|error: expected initializer before ‘FMOD_File_SetDiskBusy’|
C:\FMOD\api\inc\fmod.h|1820|error: expected initializer before ‘FMOD_File_GetDiskBusy’|
C:\FMOD\api\inc\fmod.h|1826|error: expected initializer before ‘FMOD_System_Create’|
C:\FMOD\api\inc\fmod.h|1827|error: expected initializer before ‘FMOD_System_Release’|
C:\FMOD\api\inc\fmod.h|1838|error: expected initializer before ‘FMOD_System_SetOutput’|
C:\FMOD\api\inc\fmod.h|1839|error: expected initializer before ‘FMOD_System_GetOutput’|
C:\FMOD\api\inc\fmod.h|1840|error: expected initializer before ‘FMOD_System_GetNumDrivers’|
C:\FMOD\api\inc\fmod.h|1841|error: expected initializer before ‘FMOD_System_GetDriverInfo’|
C:\FMOD\api\inc\fmod.h|1842|error: expected initializer before ‘FMOD_System_GetDriverInfoW’|
C:\FMOD\api\inc\fmod.h|1843|error: expected initializer before ‘FMOD_System_GetDriverCaps’|
C:\FMOD\api\inc\fmod.h|1844|error: expected initializer before ‘FMOD_System_SetDriver’|
C:\FMOD\api\inc\fmod.h|1845|error: expected initializer before ‘FMOD_System_GetDriver’|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

Snippet of error code:
typedef FMOD_RESULT (F_CALLBACK *FMOD_SYSTEM_CALLBACK) (FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACKTYPE type, void *commanddata1, void *commanddata2);

typedef FMOD_RESULT (F_CALLBACK *FMOD_CHANNEL_CALLBACK) (FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *commanddata1, void *commanddata2);

The issue is the declaration of F_CALLBACK in the function typedefs.(similar issues remain throughout the rest of the code)

I have [b:3ou3uzjs]no idea[/b:3ou3uzjs] what’s causing this. Is there any way I can fix this problem without reverting from C++11?

My only conclusion was that Cygwin/MSVC style attribute declaration was lost when switching to C++0x.
So I changed the F_STDCALL macro from "_stdcall" under WIN32 to "attribute((stdcall))", and of course it’s all good. I only plan to compile under GCC, so this hack works for me. I would really like to recommend that the FMOD developers add another block to the macro definition to define them appropriately for the GCC compiler.

  • You must to post comments

I also have just had this issue.
Firstly, thank you for posting about it, its helped me.
Secondly, i resolved it by changing the _stdcall (single leading underscore) to __stdcall (double leading underscore).

also changed these: (near top of fmod.h)
#define F_CDECL __cdecl
#define F_STDCALL __stdcall
#define F_DECLSPEC __declspec

Now things compile!

I recently changed from GCC 4.6.1 to GCC 4.7.1, and set -std=C++11 which caused the issue.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.