我在学校有一个小组项目(3D FPS 游戏),我使用 C++ 中的 OpenAL 和 OGG Vorbis 编写音频。我们的编译器设置为警告我们已定义但未使用的变量,这被证明是 Vorbis 的一个问题。当我编译我们的应用程序时,我得到了这个:
[ 8%] Building CXX object CMakeFiles/fps.dir/src/audio/Sound.cpp.o
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:82:21: warning: ‘OV_CALLBACKS_NOCLOSE’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:89:21: warning: ‘OV_CALLBACKS_STREAMONLY’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:96:21: warning: ‘OV_CALLBACKS_STREAMONLY_NOCLOSE’ defined but not used [-Wunused-variable]
[ 9%] Building CXX object CMakeFiles/fps.dir/src/audio/MenuAudioController.cpp.o
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:75:21: warning: ‘OV_CALLBACKS_DEFAULT’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:82:21: warning: ‘OV_CALLBACKS_NOCLOSE’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:89:21: warning: ‘OV_CALLBACKS_STREAMONLY’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:96:21: warning: ‘OV_CALLBACKS_STREAMONLY_NOCLOSE’ defined but not used [-Wunused-variable]
[ 10%] Building CXX object CMakeFiles/fps.dir/src/audio/GameAudioController.cpp.o
In file included from /home/berzeger/FPS/FPS/trunk/game/src/audio/GameAudioController.cpp:1:0:
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:75:21: warning: ‘OV_CALLBACKS_DEFAULT’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:82:21: warning: ‘OV_CALLBACKS_NOCLOSE’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:89:21: warning: ‘OV_CALLBACKS_STREAMONLY’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:96:21: warning: ‘OV_CALLBACKS_STREAMONLY_NOCLOSE’ defined but not used [-Wunused-variable]
[ 11%] Building CXX object CMakeFiles/fps.dir/src/audio/AudioController.cpp.o
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:75:21: warning: ‘OV_CALLBACKS_DEFAULT’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:82:21: warning: ‘OV_CALLBACKS_NOCLOSE’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:89:21: warning: ‘OV_CALLBACKS_STREAMONLY’ defined but not used [-Wunused-variable]
/home/berzeger/FPS/FPS/trunk/game/src/audio/../../include/vorbis/vorbisfile.h:96:21: warning: ‘OV_CALLBACKS_STREAMONLY_NOCLOSE’ defined but not used [-Wunused-variable]
等等。您可以看到这是一团糟,重要的东西很容易丢失。
我似乎无法找到一种方法来抑制 vorbis 未使用的变量。我试过
#define OV_EXCLUDE_STATIC_CALLBACKS
但这会禁用所有 vorbis 定义,这不是我想要的。
有人可以帮忙吗?提前致谢!