3

.lib(library) ファイルに未解決の外部シンボルが見つかった場合の対処方法。.c または .cpp に未解決の外部シンボルが見つかった場合は、修正できます。しかし、.lib(library) ファイルに未解決の外部シンボルが見つかった場合、どうすればこれを解決できますか?

私の場合、次のようなリンカ エラーが見つかりました。

エラー 1 エラー LNK2019: 関数 _fprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-global.o) で参照されている未解決の外部シンボル ___mingw_vfprintf エラー 2 エラー LNK2001: 未解決の外部シンボル ___mingw_Vidfprint\Playa TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-misc.o) エラー 3 エラー LNK2001: 未解決の外部シンボル _gpg_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libvlc.lib) エラー (eccwin\libvlccore.lib)エラー LNK2019: 未解決の外部シンボル _gpg_strerror が関数 __gcry_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt で参照されています。lib(libgcrypt_la-global.o) エラー 5 エラー LNK2001: 未解決の外部シンボル _gpg_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-misc.o) エラー 6 エラー LNK2001: 未解決の外部シンボル _gpg_strerror D :\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(md.o) エラー 7 エラー LNK2001: 未解決の外部シンボル _gpg_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\cryptgcryptlib.lib.vlc(core\vlcwin\cryptgcryptlib.vlc o) エラー 8 エラー LNK2019: 関数 __gcry_strsource D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt で参照されている未解決の外部シンボル _gpg_strsource。lib(libgcrypt_la-global.o) エラー 9 エラー LNK2019: 関数 _do_malloc で参照されている未解決の外部シンボル _gpg_err_set_errno external symbol _gpg_err_set_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-stdmem.o) Error 11 error LNK2001: unresolved external symbol _gpg_err_set_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt. lib(libgcrypt_la-secmem.o) エラー 12 エラー LNK2001: 未解決の外部シンボル _gpg_err_code_from_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-module.o) Error 13 error LNK2019: unresolved external symbol _gpg_err_code_from_errno referenced in function _gpg_err_make_from_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib (libgcrypt_la-global.o) エラー 14 エラー LNK2001: 未解決の外部シンボル _gpg_err_code_from_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-sexp.o) エラー 15 エラー LNK2001: 未解決の外部シンボル D:\VidPlaya_offline\TryingToIncludeUpdateFacility\libgcrypt.lib(libgcrypt_la-sexp.o) \VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(md.o) エラー 16 エラー LNK2001:unresolved external symbol _gpg_err_code_from_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(primegen.o) Error 17 error LNK2019: unresolved external symbol ___mingw_vsprintf referenced in function _sprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore \libgcrypt.lib(libgcrypt_la-sexp.o) エラー 18 エラー LNK2001: 未解決の外部シンボル ___mingw_vsprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(ac.o) エラー 19 エラー LNK2001: 未解決の外部シンボル _gpg_errorerr_ D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(primegen.o) エラー 20 エラー LNK2019:unresolved external symbol _gpg_err_code_from_syserror referenced in function _progress D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(dsa.o) Error 21 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore \libgcrypt.lib(ecc.o) エラー 22 エラー LNK2001: 未解決の外部シンボル _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(random-fips.o) エラー 23 エラー LNK2001: コード未解決の外部シンボル _gpg_error_syserr D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(mpicoder.o) Error 24 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(cipher.o) Error 25 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\ vlcwin\libvlccore\libgcrypt.lib(pubkey.o) エラー 26 エラー LNK2001: 未解決の外部シンボル _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(kdf.o) エラー 27 エラー LNK2019: 未解決の外部シンボル関数 __gcry_pk_get_keygrip D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(pubkey.o) エラー 28 エラー LNK2001: 未解決の外部シンボル _snprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(md.o) エラー 29 エラー LNK2001: 未解決の外部シンボル _snprintf D:\VidPlaya_offline\TryingToIncluded_Updateacid_Updated_UpdateFacility vlcwin\libvlccore\libgcrypt.lib(ecc.o) エラー 30 エラー LNK2001: 未解決の外部シンボル _snprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(rndw32.o) エラー 31 エラー LNK2019: 未解決の外部シンボル関数 _init_pool D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-secmem.o) エラー 32 エラー LNK2019 で参照される _getpagesize:unresolved external symbol _gettimeofday referenced in function _x931_get_dt D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(random-fips.o) Error 33 error LNK2001: unresolved external symbol _gettimeofday D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin \libvlccore\libgcrypt.lib(random-csprng.o) エラー 34 エラー LNK1120: 10 個の未解決の外部 D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\Release\libvlccore.dll エラー 89 エラー LNK2001: 未解決の外部シンボル "パブリック: 仮想構造体QMetaObject const * __thiscall UpdateDialog::metaObject(void)const " (?metaObject@UpdateDialog@@UBEPBUQMetaObject@@XZ) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.obj エラー 90 エラー LNK2001: 未解決の外部シンボル "public: virtual void * __thiscall UpdateDialog::qt_metacast(char const *)" (?qt_metacast@UpdateDialog@@UAEPABD@Z) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.obj エラー 91 エラー LNK2001: 未解決の外部シンボル "public: virtual int __thiscall UpdateDialog::qt_metacall(enum QMetaObject::Call,int,void *)" (?エラー 92 エラー LNK1120: 3 つの未解決の外部 D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\Release\plugins\lib_plugin.dll

これに関する提案は役に立ちます。

4

2 に答える 2

3

まあ、基本的には、ライブラリを見つける必要があります-.libまたは.a(プラットフォームによって異なります)ファイルで、そのシンボルがあります。静的ライブラリは、実行可能ライブラリまたは共有ライブラリにリンクされるまでシンボルを解決しないため、すべてのシンボルが解決されていない静的ライブラリがある場合があります。これは、ポイント 1 で説明したツールを使用して確認できます。シンボルをダンプすると、未解決のシンボルのU前に文字が付きます。それらをアプリケーションにリンクするとき、リンカーはすべてのシンボルを解決する必要があり、何かが欠けていると、未解決の参照エラーが発生します。基本的に次の 2 つのオプションがあります。

nm1) (Linux および Windows 上の MinGW) または (Windows上の Visual Studio)のようなシンボル ダンプ ユーティリティを使用し、シンボルdumpbinに対して grep を使用します (ライブラリでいっぱいのディレクトリがある場合は、ファイルごとにこれを行うスクリプトを作成できます)。次に、正しいライブラリ ファイルがそれに対してコードをリンクしていることがわかっている場合 (ここでも-l<library name>、Linux および MinGW Windows のプラットフォーム スイッチに依存し#pragma comment(lib, "<library name>")、Visual Studio のプロパティ ページからライブラリを追加または指定します。

2)すべてのライブラリのソースがある場合は、関数の定義をプレーンテキストで検索してから、ソースを持つライブラリに対してリンクすることができます。

3) これらの問題は、既に適切なライブラリとリンクしているが、C と C++ コードが混在している場合でも発生する可能性があります。C インターフェイスを持つライブラリでは、ヘッダー インクルードをextern "C"ブロックにラップする必要があります。これにより、C 名を持つ関数のみが使用可能な場合にリンカーが C++ 名を持つ関数を見つけようとしなくなります。これは、FFmpeg やその他の大規模なオープン ソース プロジェクトの初心者によくある問題です。

アップデート

元の問題について__mingw_vfprinfは、MinGW でコンパイルされたコードを Visual Studio にリンクするのは少し奇妙です。プロジェクトにも MinGW を使用する方が良いと思いますが、同様のトピックが見つからないことが原因である可能性がありlibmingwex.aます。MinGW ツールチェーンがある場合は、ファイルの場所を見つけ、そのディレクトリを Visual Studio プロパティ ページを介してリンカー検索ディレクトリに追加libmingwex.aし、Visual Studio プロパティ ページまたは上記のプラグマを介してプロジェクトにリンカー入力として追加します。MinGW ツールチェーンを持っていない場合はダウンロードする必要がありますが、適切なプラットフォームを取得する必要があります。

更新 2

どのパッケージにライブラリが含まれているかを示す MinGW パッケージ マネージャーのサンプル スクリーンショットを次に示します。

libmingwex.a を表示する MinGW パッケージ マネージャー

于 2014-10-21T14:53:09.770 に答える
1

他のランタイム ライブラリの実装に関する私の経験から、さまざまなバリエーションは下位レベルのフォーム printfを呼び出すことによって実装されると思います。が.oファイルに入れられ(なぜですか?それ自体がRTL関数ではないのですか?)、そのヘルパー関数が必要です。装飾という名前から、それは mingw システム ライブラリにあると思います。printf 関数は、msvcrt.dll のものよりも強化されているため、リンクする必要がある補足ライブラリにあると思います。 vprintffprintf

だから、それを探してください。ライブラリが現在使用しているバージョンとは異なるバージョンに対してビルドされ、それらの詳細が変更されている可能性があるため、バージョンも確認してください。

于 2014-10-21T14:38:24.053 に答える