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

Arduino使用Boost.SML库遇C++14支持错误求助

Arduino中使用Boost.SML库触发C++14版本检测错误的解决求助

刚接触Arduino,希望在项目中使用boost sml库,已下载sml.hpp文件并通过库管理器添加到项目,但编译运行时出现如下错误:

error: #error "[Boost::ext].SML requires C++14 support (Clang-3.4+, GCC-5.1+, MSVC-2015+)"
 #error "[Boost::ext].SML requires C++14 support (Clang-3.4+, GCC-5.1+, MSVC-2015+)"

我的Arduino配置如下:

{
    "board": "arduino:avr:micro",
    "programmer": "avrisp",
    "port": "/dev/ttyACM0",
    "output": "../build",
    "sketch": "test.ino",
    "intelliSenseGen": "global"
}

使用的avr-gcc版本为7.3.0(理论支持C++14),已做以下配置尝试:

  • 在c_cpp_properties.json中设置C++标准为14,相关配置片段:
"configurations": [
        {
            "name": "Arduino",
            "compilerPath": "home/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++",
            "compilerArgs": [
                "-w",
                "-std=c++14",
                ...
            ],
            "cppStandard": "c++14",
            "defines": [
...
"__cplusplus=201402L", 
...
  • 在tasks.json中也添加了-std=c++14参数

但错误仍在sml.hpp的如下判断代码处触发:

#if (__cplusplus < 201305L && _MSC_VER < 1900)
#error "[Boost::ext].SML requires C++14 support (Clang-3.4+, GCC-5.1+, MSVC-2015+)" 
#else

恳请各位提供解决帮助。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.16 02:52:18