【libuv】基于libuv的exe链接错误
vs2017构建 基于libuv的exe链接错误
1>libuv.lib(util.obj) : error LNK2019: unresolved external symbol __imp__GetAdaptersAddresses@20 referenced in function _uv_interface_addresses
1>libuv.lib(util.obj) : error LNK2019: unresolved external symbol __imp__GetUserProfileDirectoryW@12 referenced in function _uv__getpwuid_r
1>libuv.lib(process.obj) : error LNK2019: unresolved external symbol __imp__SymSetOptions@4 referenced in function _uv__kill
1>libuv.lib(process.obj) : error LNK2019: unresolved external symbol __imp__SymGetOptions@0 referenced in function _uv__kill
1>libuv.lib(process.obj) : error LNK2019: unresolved external symbol _MiniDumpWriteDump@28 referenced in function _uv__kill
1>D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\echo.exe : fatal error LNK1120: 5 unresolved externals
你遇到的错误是 链接器错误(LNK2019),表示你的程序在链接阶段找不到某些 Windows API 函数的实现。这些函数来自于系统的动态链接库(DLL),需要显式链接相应的库文件。下面是每个未解析符号及其对应的 Windows 库:
🔧 错误详解与解决方案
1. __imp__GetAdaptersAddresses@20
- ✅ 需要链接库:
Iphlpapi.lib
2. __imp__GetUserProfileDirectoryW@12
- ✅ 需要链接库:
Userenv.lib
3. __imp__SymSetOptions@4
4. __imp__SymGetOptions@0
- ✅ 需要链接库:
Dbghelp.lib
5. _MiniDumpWriteDump@28
- ✅ 需要链接库:
Dbghelp.lib
✅ 解决方法
你需要在链接设置中加入这些库,可以通过以下方式之一实现:
方法一:在 Visual Studio 中设置
-
打开项目属性。
-
选择:
- 配置属性 → 链接器 → 输入 → 附加依赖项(Additional Dependencies)
-
添加以下内容:
Iphlpapi.lib Userenv.lib Dbghelp.lib
每个库用换行或分号隔开。
方法二:在代码中通过 #pragma
添加(不推荐用于大型项目)
#pragma comment(lib, "Iphlpapi.lib")
#pragma comment(lib, "Userenv.lib")
#pragma comment(lib, "Dbghelp.lib")
🔍 补充建议
- 确保使用的 Windows SDK 安装完整,尤其是 DbgHelp 和 Userenv。
- 如果你是用 CMake 构建项目,确保
target_link_libraries
中添加了这些库。
我的exe链接成功
Build started at 0:00...
1>------ Build started: Project: echo, Configuration: Debug Win32 ------
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2189,5): warning MSB9008: The referenced project ..\..\project\razor.vcxproj does not exist.
1>x265-static.lib(analysis.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(analysis.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(search.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(search.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(bitcost.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(bitcost.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(motion.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(motion.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(slicetype.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(slicetype.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(frameencoder.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(frameencoder.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(framefilter.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(framefilter.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(level.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(level.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(nal.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(nal.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(sei.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(sei.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(sao.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(sao.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(entropy.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(entropy.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(dpb.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(dpb.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(ratecontrol.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(ratecontrol.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(reference.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(reference.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(encoder.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(encoder.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(api.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(api.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(weightPrediction.obj) : warning LNK4099: PDB 'encoder.pdb' was not found with 'x265-static.lib(weightPrediction.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\encoder.pdb'; linking object as if no debug info
1>x265-static.lib(asm-primitives.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(asm-primitives.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(vec-primitives.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(vec-primitives.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(dct-sse3.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(dct-sse3.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(dct-ssse3.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(dct-ssse3.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(dct-sse41.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(dct-sse41.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(primitives.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(primitives.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(pixel.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(pixel.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(dct.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(dct.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(lowpassdct.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(lowpassdct.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(ipfilter.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(ipfilter.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(intrapred.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(intrapred.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(loopfilter.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(loopfilter.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(constants.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(constants.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(cpu.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(cpu.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(version.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(version.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(threading.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(threading.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(threadpool.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(threadpool.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(wavefront.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(wavefront.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(md5.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(md5.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(bitstream.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(bitstream.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(yuv.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(yuv.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(shortyuv.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(shortyuv.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(picyuv.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(picyuv.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(common.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(common.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(param.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(param.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(frame.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(frame.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(framedata.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(framedata.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(cudata.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(cudata.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(slice.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(slice.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(lowres.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(lowres.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(piclist.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(piclist.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(predict.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(predict.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(scalinglist.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(scalinglist.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(quant.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(quant.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>x265-static.lib(deblock.obj) : warning LNK4099: PDB 'common.pdb' was not found with 'x265-static.lib(deblock.obj)' or at 'D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\common.pdb'; linking object as if no debug info
1>echo.vcxproj -> D:\XTRANS\thunderbolt\ayame\zhb-bifrost\player-only\Halo\Debug\echo.exe
1>Done building project "echo.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 0:00 and took 01.114 seconds ==========