Ogg/Vorbis:找不到 _ov_fopen

发布于 2024-08-28 17:29:09 字数 667 浏览 6 评论 0原文

我正在尝试将 Ogg/Vorbis 与 OpenAL 结合使用来在我的游戏中获得声音。现在我只是尝试加载 .ogg 文件并读取其数据,实际上我并没有对它执行任何操作。我第一次尝试使用 ov_open,但是,文档说我确实应该在 Windows 上使用 ov_fopen

然而,当我尝试使用它时,我得到以下结果:

1>AudioManager.obj : error LNK2019: unresolved external symbol _ov_fopen 
referenced in function "private: static struct SomeGame::SoundData * __cdecl
SomeGame::AudioManager::LoadOGG(char *)"
(?LoadOGG@AudioManager@SomeGame@@CAPAUSoundData@2@PAD@Z)

...当我 Google“未解析的外部符号 _ov_fopen”时,我得到了一个结果。而且是日语的。

所以我尝试下载 ogg 和 vorbis 源代码并编译它,并将它们插入到项目中,但它仍然给我同样的错误。

基本上,如何加载 Ogg/Vorbis 文件以便在 Windows 上与 OpenAL 一起使用?

提前致谢。

I'm trying to use Ogg/Vorbis with OpenAL to get sound in my game. Right now I'm simply trying to load a .ogg file and read its data, I'm not actually doing anything with it. I first tried using ov_open, however, the documentation said I should really be using ov_fopen on Windows.

However, when I try to use that I get the following:

1>AudioManager.obj : error LNK2019: unresolved external symbol _ov_fopen 
referenced in function "private: static struct SomeGame::SoundData * __cdecl
SomeGame::AudioManager::LoadOGG(char *)"
(?LoadOGG@AudioManager@SomeGame@@CAPAUSoundData@2@PAD@Z)

...and when I Google "unresolved external symbol _ov_fopen", I get exactly one result. And it's in Japanese.

So I tried downloading the ogg and vorbis source and compiling it, and inserting those in the project, but it still gives me the same error.

Basically, how do I load in an Ogg/Vorbis file to be used with OpenAL on Windows?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初见 2024-09-04 17:29:09

您是否正在链接 libogg、libvorbis 和 libvorbisfile?

Are you linking with libogg, libvorbis and libvorbisfile?

多情出卖 2024-09-04 17:29:09

进一步SurvivalMachine的回答;

Dependency Walker 显示 _ov_fopen 明确定义在 libvorbisfile.dll 中

或者在 Linux 上,“nm libvorbisfile.a | grep _ov_fopen " 显示 _ov_fopen 已在那里定义。

#include <vorbis/vorbisfile.h>

确保您的链接器知道在哪里可以找到 lib 文件。

请注意,您需要使用 -Wunused-variable 进行编译,或者;

#define OV_EXCLUDE_STATIC_CALLBACKS

...在包含之前。

Further to SurvivalMachine's answer;

Dependency Walker shows _ov_fopen is definitely defined in libvorbisfile.dll

Or on linux, "nm libvorbisfile.a | grep _ov_fopen" shows _ov_fopen is defined there.

#include <vorbis/vorbisfile.h>

Make sure your linker knows where to find the lib file.

Note that you'll need to either compile with -Wunused-variable or;

#define OV_EXCLUDE_STATIC_CALLBACKS

...before the include.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文