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

MFC应用中编译X86平台AWS SDK失败的问题求助

针对X86平台编译AWS SDK for C++失败的解决方法

问题描述

在MFC应用中尝试使用AWS SDK,但针对X86平台编译SDK时失败。

使用的CMake命令

cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;dynamodb;cognito-identity;iot" -DCMAKE_GENERATOR_PLATFORM=x86
cmake --build . --config=Release
cmake --install . --config=Release

编译错误信息

Build FAILED.

"C:\Users\redst\OneDrive\Documents\GitHub\xxxx\libs\aws-sdk-cpp\cmake_build\CMakeFiles\3.29.1\VCTargetsPath.vcxproj" (default target) (1) ->
(PrepareForBuild target) ->
  C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(438,5): error MSB8013: 该项目不包含 Debug|Win32 的配置和平台组合。[C:\Users\redst\OneDrive\Documents\GitHub\xxxx\libs\aws-sdk-cpp\cmake_build\CMakeFiles\3.29.1\VCTargetsPath.vcxproj]

    0 个警告
    1 个错误

已用时间 00:00:00.12
退出码:1

解决步骤

  • 彻底清理cmake_build目录,删除所有生成的文件,避免残留配置干扰后续编译
  • 修改CMake命令中的平台参数:将CMAKE_GENERATOR_PLATFORM=x86替换为CMAKE_GENERATOR_PLATFORM=Win32——MSVC环境中X86平台的标准标识是Win32,而非x86
  • 重新执行编译安装命令:
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;dynamodb;cognito-identity;iot" -DCMAKE_GENERATOR_PLATFORM=Win32
cmake --build . --config=Release
cmake --install . --config=Release
  • 确保使用x86 Native Tools Command Prompt for VS 2022执行命令,避免因开发者命令提示符的架构不匹配导致环境变量错误

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 13:40:49