当前位置: 首页 > news >正文

【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 中设置
  1. 打开项目属性。

  2. 选择:

    • 配置属性 → 链接器 → 输入 → 附加依赖项(Additional Dependencies)
  3. 添加以下内容:

    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 ==========

相关文章:

  • Kubernetes(k8s)学习笔记(四)--入门基本操作
  • AI 采用金字塔(Sohn‘s AI Adoption Pyramid)
  • Linux操作系统从入门到实战(五)详细讲解Linux权限概念
  • Python Django基于小波变换的数字水印技术实现系统【附源码、文档说明】
  • Docker —— 技术架构的演进
  • Linux实验课二(重点:动态链接库,makefile使用)
  • 经典算法 求解台阶问题
  • 【RocketMQ NameServer】- NettyEventExecutor 处理 Netty 事件
  • 软件测试 - 绪论
  • 【计算机网络-应用层】解析HTTP会话保持:Cookie与Session的原理与实践
  • 昇腾的昇思MindSpore是什么?跟TensorFlow/PyTorch 等第三方框架有什么区别和联系?【浅谈版】
  • 机器学习中的分类和回归问题
  • 网络安全系列--《文章1:网络安全基础与核心概念》
  • LeetCode Hot100题解
  • Dubbo(92)如何在微服务架构中应用Dubbo?
  • 电脑RGB888P转换为JPEG方案 ,K230的RGB888P转换为JPEG方案
  • 【C++重载操作符与转换】赋值操作符
  • 虚幻引擎入门笔记
  • 虚幻基础:角色朝向
  • 伊甸园之东: 农业革命与暴力的复杂性
  • 贵州黔西市游船倾覆事故最后一名失联人员被找到,但已无生命体征
  • 美妙的下午
  • 成为中国骑手孵化器,上海环球马术冠军赛是最好的历练舞台
  • “彩虹滑道”项目两男童相撞飞跌出去,景区:工作人员误判导致
  • 五一期间全国高速日均流量6200万辆,同比增长8.1%
  • 聚焦各领域顶尖工匠,《上海工匠》第十季于五一播出