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

私は混乱しています。助けていただけますか?ありがとう。

4

2 に答える 2

0

ogg-vorbis をコンパイルした C ランタイムを確認してください。静的にリンクしている場合は、アプリと一致する必要があります。

代わりに vorbis を DLL にコンパイルした場合は、別の c ランタイムを使用できる場合があります (vorbis DLL によって割り当てられたメモリが常にその DLL によって解放され、それが c のみの API である場合)。

于 2011-06-19T17:54:44.690 に答える
0

リンク: 警告 LNK4098: defaultlib 'MSVCRT' は他のライブラリの使用と競合します。/NODEFAULTLIB:ライブラリを使用

Orbis とは関係ありません。これは、c stdlib と MFC の C stdlib の両方を同じプログラムでリンクしようとしたときに得られるものです。コンパイラの指示に従ってください。または、libcmt/d を無視するように設定するだけです

于 2011-03-07T17:05:11.803 に答える