本文介绍了libgcrypt.lib中无法解析的外部符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在.lib(library)文件中发现了无法解析的外部符号,该怎么办.如果在.c或.cpp中发现无法解析的外部符号,则可以对其进行修复.但是,当我在.lib(library)文件中找到未解析的外部符号时,该如何解决呢?

What I have to do if i found Unresolved external symbol in .lib(library) file. If I found unresolved external symbol in .c or .cpp I can fix it. But when i found Unresolved external symbol in .lib(library) file how can i solve this?

就我而言,我发现了这样的链接器错误:

In my case i found a linker error like this:

错误1错误LNK2019:函数_fprintf中引用的未解析的外部符号___mingw_vfprintf D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(libgcrypt_la-global.o)错误2错误LNK2001:无法解析的外部符号___mingw_vfprintf D:\ VidPlaya_offline \ 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 \ libgcrypt.lib(ecc.o)错误4错误LNK2019:函数__gcry_strerror中引用的未解析的外部符号_gpg_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 \ libvlccore \ libgcrypt.lib(libgcrypt_la-fips.o)错误8错误LNK2019:函数__gcry_strsource中引用的未解析的外部符号_gpg_strsource D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(libgcrypt_la-global.o)错误9错误LNK2019:函数_do_malloc D中引用的未解析的外部符号_gpg_err_set_errno D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(libgcrypt_la-global.o)错误10错误LNK2001:无法解析的外部符号_gpg_err_set_errno D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(libgcrypt_la-stdmem.o)错误11错误LNK2001:无法解析的外部符号_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)错误13错误LNK2019:函数_gpg_err_make_from_errno D中引用的未解析的外部符号_gpg_err_code_from_errno D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(lib.错误14错误LNK2001:无法解析的外部符号_gpg_err_code_from_errno D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(libgcrypt_la-sexp.o)错误15错误LNK2001:无法解析的外部符号_gpg_err_code_from_errno D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(md.o)错误16错误LNK2001:无法解析的外部符号_gpg_err_code_from_errno D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(primegen.o)错误17错误LNK2019:函数_sprintf中引用的未解析的外部符号___mingw_vsprintf 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_err_code_from_syserror D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(primegen.o)错误20错误LNK2019:函数_progress D中引用的未解决的外部符号_gpg_err_code_from_syserror D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(dsa.o)错误21错误LNK2001:无法解析的外部符号_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_err_code_from_syserror D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(mpicoder.o)错误24错误LNK2001:无法解析的外部符号_gpg_err_code_from_syserror D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(cipher.o)错误25错误LNK2001:无法解析的外部符号_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中引用的未解析的外部符号_snprintf 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 \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ 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中引用的未解析的外部符号_getpagesize:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(libgcrypt_la-secmem.o)错误32错误LNK2019:函数_x931_get_dt D中引用的未解析的外部符号_gettimeofday D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ libvlccore \ libgcrypt.lib(random-fips.o)错误33错误LNK2001:无法解析的外部符号_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:未解析的外部符号"public:虚拟结构QMetaObject const * __thiscall UpdateDialog :: metaObject(void)const"(?metaObject @ UpdateDialog @@ UBEPBUQMetaObject @@ XZ)D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_inwined \ help.obj错误90错误LNK2001:未解决的外部符号公共:虚拟void * __thiscall UpdateDialog :: qt_metacast(char const *)"(?qt_metacast @ UpdateDialog @@ UAEPAXPBD @ Z)D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_Embeddedlib \ in .obj错误91错误LNK2001:无法解析的外部符号公共:虚拟int __thiscall UpdateDialog :: qt_metacall(枚举QMetaObject :: Call,int,void * *)"(?qt_metacall @ UpdateDialog @@ UAEHW4Call @ QMetaObject @@ HPAPAX @ Z)D: \ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ lib_plugin \ help.obj错误92错误LNK1120:3个未解决的外部D:\ VidPlaya_offline \ TryingToIncludeUpdateFacility \ Vidplaya_Plugin_EmbeddedUpdate \ vlcwin \ Release \ plugins \ lib_plugin.dll

Error 1 error LNK2019: unresolved external symbol ___mingw_vfprintf referenced in function _fprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-global.o)Error 2 error LNK2001: unresolved external symbol ___mingw_vfprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-misc.o)Error 3 error LNK2001: unresolved external symbol _gpg_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(ecc.o)Error 4 error LNK2019: unresolved external symbol _gpg_strerror referenced in function __gcry_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-global.o)Error 5 error LNK2001: unresolved external symbol _gpg_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-misc.o)Error 6 error LNK2001: unresolved external symbol _gpg_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(md.o)Error 7 error LNK2001: unresolved external symbol _gpg_strerror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-fips.o)Error 8 error LNK2019: unresolved external symbol _gpg_strsource referenced in function __gcry_strsource D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-global.o)Error 9 error LNK2019: unresolved external symbol _gpg_err_set_errno referenced in function _do_malloc D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-global.o)Error 10 error LNK2001: unresolved 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)Error 12 error LNK2001: unresolved external symbol _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)Error 14 error LNK2001: unresolved external symbol _gpg_err_code_from_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-sexp.o)Error 15 error LNK2001: unresolved external symbol _gpg_err_code_from_errno D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(md.o)Error 16 error 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)Error 18 error LNK2001: unresolved external symbol ___mingw_vsprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(ac.o)Error 19 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(primegen.o)Error 20 error 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)Error 22 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(random-fips.o)Error 23 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror 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)Error 26 error LNK2001: unresolved external symbol _gpg_err_code_from_syserror D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(kdf.o)Error 27 error LNK2019: unresolved external symbol _snprintf referenced in function __gcry_pk_get_keygrip D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(pubkey.o)Error 28 error LNK2001: unresolved external symbol _snprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(md.o)Error 29 error LNK2001: unresolved external symbol _snprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(ecc.o)Error 30 error LNK2001: unresolved external symbol _snprintf D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(rndw32.o)Error 31 error LNK2019: unresolved external symbol _getpagesize referenced in function _init_pool D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\libvlccore\libgcrypt.lib(libgcrypt_la-secmem.o)Error 32 error LNK2019: 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)Error 34 error LNK1120: 10 unresolved externals D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\Release\libvlccore.dllError 89 error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall UpdateDialog::metaObject(void)const " (?metaObject@UpdateDialog@@UBEPBUQMetaObject@@XZ) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.objError 90 error LNK2001: unresolved external symbol "public: virtual void * __thiscall UpdateDialog::qt_metacast(char const *)" (?qt_metacast@UpdateDialog@@UAEPAXPBD@Z) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.objError 91 error LNK2001: unresolved external symbol "public: virtual int __thiscall UpdateDialog::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@UpdateDialog@@UAEHW4Call@QMetaObject@@HPAPAX@Z) D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\lib_plugin\help.objError 92 error LNK1120: 3 unresolved externals D:\VidPlaya_offline\TryingToIncludeUpdateFacility\Vidplaya_Plugin_EmbeddedUpdate\vlcwin\Release\plugins\lib_plugin.dll

关于此的任何建议都会有所帮助.

Any suggestions regarding this would be helpful.

推荐答案

好吧,基本上,您必须找到具有该符号的库-.lib或.a(取决于平台)文件.静态库在链接到可执行库或共享库之前不会解析它们的符号,因此您可能有一个静态库未解决其所有符号.您可以使用第1点下面提到的工具来验证这一点-当您转储符号时,未解析的符号将在它们前面带有U字母.当您将它们链接到应用程序时,链接器必须解析所有符号,如果缺少某些符号,则会出现无法解析的参考错误.您基本上有两个选择:

Well, basically you have to find the library - .lib or .a (depending on the platform) file that has that symbol. Static libraries do not resolve their symbols until being linked into an executable or shared library, so you may have a static library that does not have all its symbols resolved. You can verify this using the tools mentioned lower in point 1 - when you dump the symbols the unresolved ones will have a U letter before them. And when you are linking them into your application the linker must resolve all the symbols, and if something is missing you get unresolved reference errors. You basically have two options:

1)使用符号转储实用程序,例如nm(在Windows上为Linux和MinGW)或dumpbin(在Windows上为Visual Studio),并使用grep作为符号(如果您的目录中充满了库,则可以编写脚本)然后为每个文件执行此操作),然后当您知道正确的库文件时,将代码链接至该文件(再次取决于Linux和MinGW窗口的平台-l<library name>开关,添加#pragma comment(lib, "<library name>")或通过以下属性页指定库) Visual Studio.

1) Use a symbol dumping utility like nm (Linux and MinGW on Windows) or dumpbin (Visual Studio on Windows) and grep for the symbol (if you have a directory full of libraries you can make a script that does this for each file), and then when you know the correct library file link your code against it (again depends on platform -l<library name> switch for Linux and MinGW windows , add #pragma comment(lib, "<library name>") or specify the library through the property pages in Visual Studio.

2)如果您拥有所有库的源代码,则可以执行纯文本搜索功能的定义,然后链接具有源代码库的库.

2) If you have sources for all the libraries you can do a plain text search for the definition of the function and then linking against the library that has the source should do.

3)即使您已经与适当的库链接,但C和C ++代码混合在一起,也可能会出现这些问题.具有C接口的库的标头应包含在extern "C"块中,这样,当只有具有C名称的函数可用时,链接程序就不会尝试查找具有C ++名称的函数.对于FFmpeg和其他大型开源项目的初学者来说,这是一个常见问题.

3) These issues may also appear even if you are already linking with the proper library but C and C++ code is being mixed. Libraries with C interface should have their header includes wrapped in an extern "C" block, so that the linker does not try to find a function with the C++ name when only a function with a C name is available. This is a common issue for beginners with FFmpeg and other big open source projects.

更新

关于__mingw_vfprinf的原始问题—奇怪的是,您正在用Visual Studio链接用MinGW编译的代码,我想说您最好也将MinGW用于您的项目,但是如类似主题,这可能是由于缺少libmingwex.a引起的.如果您具有MinGW工具链,请找到文件所在的位置,然后通过Visual Studio属性页将该目录添加到链接器搜索目录中,并通过Visual Studio属性页或通过提到的编译指示将libmingwex.a作为链接器输入添加到您的项目中以上.如果您没有MinGW工具链,则应该下载它,但是您需要获得正确的平台—但是我想,既然您在某个地方找到了库,就知道它是32位还是64位.

As for the original issue with __mingw_vfprinf — it is a bit weird that you are linking code that has been compiled with MinGW with Visual Studio, I'd say you'd be better of using MinGW for your project too, but as suggested in a similar topic this could be cause by missing libmingwex.a. If you have the MinGW toolchain, find where the file is located, add that directory to linker search directories via Visual Studio property pages and add libmingwex.a as a linker input to your project either through the Visual Studio property pages or via the pragma mentioned above. If you don't have the MinGW toolchain then you should download it, but you need to get the right platform — however I guess since you got the library somewhere you know if it is 32bit or 64bit.

更新2

下面是MinGW软件包管理器的示例屏幕快照,显示了哪个软件包包含该库:

Here is a sample screenshot of MinGW package manager showing which package contains the library:

这篇关于libgcrypt.lib中无法解析的外部符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 01:53