Environment:
- OS: Arch Linux
- Compiler: GCC (cc1plus)
- Build System: CMake / Make
When attempting to compile Barony from source, the build fails at src/engine/audio/sound_game.cpp due to syntax errors surrounding the F_CALLBACK macro. The compiler does not recognize or properly handle the macro for several FMOD callback functions, resulting in an expected initializer before error and subsequent "not declared in this scope" failures.
To Reproduce
- Clone the repository on a modern Linux system
- Configure the build using CMake with FMOD enabled (
-DFMOD_ENABLED=ON).
- Run
make.
- The build fails when compiling
sound_game.cpp.
Error Log Snippet
/src/engine/audio/sound_game.cpp:3247:24: error: expected initializer before ‘ensembleExplorationCallback’
3247 | FMOD_RESULT F_CALLBACK ensembleExplorationCallback(FMOD_CHANNELCONTROL* channelcontrol,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/src/engine/audio/sound_game.cpp:3253:24: error: expected initializer before ‘ensembleCombatCallback’
3253 | FMOD_RESULT F_CALLBACK ensembleCombatCallback(FMOD_CHANNELCONTROL* channelcontrol,
| ^~~~~~~~~~~~~~~~~~~~~~
/src/engine/audio/sound_game.cpp: In member function ‘void EnsembleSounds_t::playSong()’:
/src/engine/audio/sound_game.cpp:3276:62: error: ‘ensembleExplorationCallback’ was not declared in this scope
(Note: A similar error also occurs earlier in the file for pcmreadcallback around line 1223).
Suggested Fix
The F_CALLBACK calling convention macro is causing GCC to choke on Linux. Removing F_CALLBACK from both the forward declarations and function definitions resolves the issue and allows the compilation to finish successfully.
The following functions need to be updated in src/engine/audio/sound_game.cpp:
1. pcmreadcallback (around line 1223)
// Change from:
FMOD_RESULT F_CALLBACK pcmreadcallback(FMOD_SOUND* sound, void* data, unsigned int datalen)
// To:
FMOD_RESULT pcmreadcallback(FMOD_SOUND* sound, void* data, unsigned int datalen)
2. ensembleExplorationCallback (around lines 3247 and 4028)
// Change from:
FMOD_RESULT F_CALLBACK ensembleExplorationCallback(FMOD_CHANNELCONTROL* channelcontrol, ...
// To:
FMOD_RESULT ensembleExplorationCallback(FMOD_CHANNELCONTROL* channelcontrol, ...
3. ensembleCombatCallback (around lines 3253 and 3789)
// Change from:
FMOD_RESULT F_CALLBACK ensembleCombatCallback(FMOD_CHANNELCONTROL* channelcontrol, ...
// To:
FMOD_RESULT ensembleCombatCallback(FMOD_CHANNELCONTROL* channelcontrol, ...
Environment:
When attempting to compile Barony from source, the build fails at
src/engine/audio/sound_game.cppdue to syntax errors surrounding theF_CALLBACKmacro. The compiler does not recognize or properly handle the macro for several FMOD callback functions, resulting in anexpected initializer beforeerror and subsequent "not declared in this scope" failures.To Reproduce
-DFMOD_ENABLED=ON).make.sound_game.cpp.Error Log Snippet
(Note: A similar error also occurs earlier in the file for
pcmreadcallbackaround line 1223).Suggested Fix
The
F_CALLBACKcalling convention macro is causing GCC to choke on Linux. RemovingF_CALLBACKfrom both the forward declarations and function definitions resolves the issue and allows the compilation to finish successfully.The following functions need to be updated in
src/engine/audio/sound_game.cpp:1.
pcmreadcallback(around line 1223)2.
ensembleExplorationCallback(around lines 3247 and 4028)3.
ensembleCombatCallback(around lines 3253 and 3789)