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

编译Intel oneAPI Base_Vector_Add示例遇版本冲突错误,求解决方案

问题

编译Intel oneAPI示例Base_Vector_Add时出现如下编译错误:

In file included from C:\Users\Adithya\source\repos\Base_Vector_Add\src\vector-add-usm.cpp:22:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\include\sycl\sycl.hpp:11:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\include\sycl\accessor.hpp:11:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\include\sycl\access\access.hpp:14:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\include\sycl\CL\__spirv\spirv_ops.hpp:24:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\include\sycl\CL\__spirv\spirv_types.hpp:12:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\include\sycl\half_type.hpp:11:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\include\sycl\bit_cast.hpp:11:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\type_traits(528,30): error: redefinition of '_Is_memfunptr<_Ret
      (_Arg0::*)(_Types...) __attribute__((fastcall))>'
  528 | _MEMBER_CALL_CV_REF_NOEXCEPT(_IS_MEMFUNPTR)
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\type_traits(451,25): note: expanded from macro '_MEMBER_CALL_CV_REF_NOEXCEPT'

已知冲突源于Intel oneAPI 2024.1仅兼容VS2022 17.9.2,但当前使用的是VS2022 17.9.7社区版,无法直接回滚,求解决办法。

解决方案

一、不回滚Visual Studio的兼容修复方案

  • 升级Intel oneAPI到最新兼容版本:更新oneAPI至适配VS2022 17.9.7的版本,新版本通常会修复工具集兼容性问题。
  • 指定兼容的MSVC工具集:
    1. 打开VS项目属性,进入「常规」→「平台工具集」,尝试选择v143系列的17.9.2版本工具集(若已安装)。
    2. 若未安装旧工具集,打开Visual Studio Installer,选择「修改」当前VS实例,在「单个组件」中搜索「MSVC v143 - VS 2022 C++ x64/x86生成工具」,勾选17.9.2版本组件完成安装,再回到项目选择对应工具集。
  • 使用Intel oneAPI命令行编译:
    打开「Intel oneAPI Command Prompt for Visual Studio 2022」,切换到代码目录,执行以下命令编译:
    icpx -fsycl vector-add-usm.cpp -o vector-add-usm.exe
    
    命令行环境会自动加载兼容的编译配置,规避IDE中的工具集冲突。

二、回滚Visual Studio 2022社区版到17.9.2版本

  1. 卸载当前版本:打开「设置」→「应用和功能」,找到「Microsoft Visual Studio Community 2022」,选择「修改」→「卸载」,等待完成。
  2. 下载旧版本安装包:通过微软VS版本归档渠道获取VS2022 17.9.2社区版离线安装包。
  3. 安装指定版本:运行离线安装包,勾选「C++开发工具」等oneAPI所需组件,完成安装后即可与oneAPI 2024.1兼容。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.23 20:05:55