You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio 2022编译Libcurl x64静态调试库遇LNK1112错误求助

解决LibCurl x64静态调试版本编译LNK1112架构冲突错误

问题场景

  • 本地克隆最新版LibCurl,计划通过nMake构建适配Visual Studio 2022的静态调试库
  • 执行以下命令成功编译出x86调试库:
    nmake /f Makefile.vc mode=static VC=17 debug=yes
    
  • 尝试编译x64版本时,执行命令:
    nmake /f Makefile.vc mode=static VC=17 machine=x64 debug=yes
    
    持续触发致命错误:

    fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'

    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x86\nmake.exe" /NOLOGO /F MakefileBuild.vc' : return code '0x2'

解决方法

  • 错误原因:使用了Developer Powershell而非VS 2022的x64原生工具命令提示符,导致系统调用的是x86版本的nMake,与目标编译架构x64不匹配
  • 修复步骤:
    1. 删除之前编译生成的文件,重新克隆LibCurl仓库(或清理编译目录)
    2. 打开Visual Studio 2022的「x64原生工具命令提示符」
    3. 再次执行x64版本的编译命令,即可顺利完成编译

内容的提问来源于stack exchange,提问作者BTubbs200

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 06:32:39