将 ogg vorbis 编码添加到我的项目中

发布于 2024-10-20 14:20:52 字数 3750 浏览 7 评论 0原文

对于我的 MFC 应用程序,我需要将数组中的 .wav 数据转换为 ogg vorbis 格式。

我将 libogg 和 libvorbis 编译为静态库。我在项目文件夹中创建了“bin”目录,并将 libvorbis_static.lib 和 libvorbisfile_static.lib 放置在那里。另外,我在 bin 目录中创建了 libvorbis 文件夹,并在其中创建了一个 include 文件夹,并放置了 vorbis(带有 codec.h、vorbisfile.h、vorbisenc.h)和 ogg(带有 os_types.h 和 ogg.h)文件夹。我将 libvorbis_static.lib 添加到项目的其他依赖项中,并将 bin 文件夹添加到其他库目录中。

当我尝试编译时,出现错误:

1>libvorbis_static.lib(info.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance

1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined in libcmtd.lib(dbgfree.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _calloc already defined in libcmtd.lib(dbgcalloc.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc already defined in libcmtd.lib(dbgmalloc.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _realloc already defined in libcmtd.lib(dbgrealloc.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _memmove already defined in libcmtd.lib(memmove.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _ldexp already defined in libcmtd.lib(_ldexp_.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _qsort already defined in libcmtd.lib(qsort.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _ceil already defined in libcmtd.lib(_ceil_pentium4_.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _exit already defined in libcmtd.lib(crt0dat.obj)

1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in libcmtd.lib(typinfo.obj)

1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in libcmtd.lib(typinfo.obj)

1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_stream_clear

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_page_eos

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_stream_pageout

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_stream_flush

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_stream_packetin

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_stream_init

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_readinit

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_bytes

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_writeclear

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_read

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_reset

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_write

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_writeinit

1>libvorbis_static.lib(bitrate.obj) : error LNK2001: unresolved external symbol _oggpack_writetrunc

1>libvorbis_static.lib(bitrate.obj) : error LNK2001: unresolved external symbol _oggpack_get_buffer

1>libvorbis_static.lib(codebook.obj) : error LNK2001: unresolved external symbol _oggpack_adv

1>libvorbis_static.lib(codebook.obj) : error LNK2001: unresolved external symbol _oggpack_look

1>.\Debug/Book.exe : fatal error LNK1120: 17 unresolved externals

我很困惑。你能帮忙吗? 谢谢。

For my MFC application, I need to convert .wav data in an array into ogg vorbis format.

I compiled both libogg and libvorbis as static libraries. I created "bin" directory in my project folder and placed there libvorbis_static.lib and libvorbisfile_static.lib. Also, I created in the bin directory libvorbis folder, and an include folder in it, and placed there vorbis (with codec.h, vorbisfile.h, vorbisenc.h) and ogg (with os_types.h and ogg.h) folders. I added libvorbis_static.lib to additional dependencies of my project and the bin folder to Additional Library Directories.

When I am trying to compile, I get errors:

1>libvorbis_static.lib(info.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance

1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined in libcmtd.lib(dbgfree.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _calloc already defined in libcmtd.lib(dbgcalloc.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc already defined in libcmtd.lib(dbgmalloc.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _realloc already defined in libcmtd.lib(dbgrealloc.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _memmove already defined in libcmtd.lib(memmove.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _ldexp already defined in libcmtd.lib(_ldexp_.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _qsort already defined in libcmtd.lib(qsort.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _ceil already defined in libcmtd.lib(_ceil_pentium4_.obj)

1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _exit already defined in libcmtd.lib(crt0dat.obj)

1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in libcmtd.lib(typinfo.obj)

1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in libcmtd.lib(typinfo.obj)

1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_stream_clear

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_page_eos

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_stream_pageout

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_stream_flush

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_stream_packetin

1>BookDoc.obj : error LNK2001: unresolved external symbol _ogg_stream_init

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_readinit

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_bytes

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_writeclear

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_read

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_reset

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_write

1>libvorbis_static.lib(info.obj) : error LNK2001: unresolved external symbol _oggpack_writeinit

1>libvorbis_static.lib(bitrate.obj) : error LNK2001: unresolved external symbol _oggpack_writetrunc

1>libvorbis_static.lib(bitrate.obj) : error LNK2001: unresolved external symbol _oggpack_get_buffer

1>libvorbis_static.lib(codebook.obj) : error LNK2001: unresolved external symbol _oggpack_adv

1>libvorbis_static.lib(codebook.obj) : error LNK2001: unresolved external symbol _oggpack_look

1>.\Debug/Book.exe : fatal error LNK1120: 17 unresolved externals

I am confused. Could you please help?
Thanks.

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

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

发布评论

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

评论(2

离鸿 2024-10-27 14:20:52

<块引用>

LINK:警告 LNK4098:defaultlib 'MSVCRT' 与其他库的使用冲突;使用 /NODEFAULTLIB:库

这与 orbis 无关,这是当您尝试在同一个程序中链接 c stdlib 和 MFC 的 C stdlib 时得到的结果 - 只需按照编译器告诉您的操作即可。
或者只是将其设置为忽略 libcmt/d

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

It's nothing to do with orbis, this is what you get when you try and link both the c stdlib and MFC's C stdlib in the same program - just do what the compiler tells you.
Or just set it to ignore libcmt/d

木槿暧夏七纪年 2024-10-27 14:20:52

检查您使用什么 c 运行时编译 ogg-vorbis。如果您静态链接,它必须与您的应用程序匹配。

如果您已将 vorbis 编译为 DLL,则可能能够使用单独的 c 运行时(如果 vorbis DLL 分配的内存始终由该 DLL 释放,并且它是仅限 c 的 API)。

Check what c-runtime you compiled ogg-vorbis with. It must match your app if you're linking statically.

If you've compiled vorbis to a DLL instead, you might be able to use separate c-runtimes (if memory allocated by the vorbis DLL is always freed by that DLL, and it's a c-only API).

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