2

I am starting out with Adruino and wanted to use the boost sml library on it. I downloaded the sml.hpp file and added it to arduino project using the library manager. But when i try to run the file I get the following error message:

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+)"

My Arduino:

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

I am using avr-gcc (gcc version 7.3.0 (GCC) so it should support c++14?) I changed the version of c++ to 14 in the c_cpp_properties.json

 "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",
                "-fpermissive",
                "-fno-exceptions",
                "-ffunction-sections",
                "-fdata-sections",
                "-fno-threadsafe-statics",
                "-Wno-error=narrowing"
            ],
            "intelliSenseMode": "gcc-x64",
            "includePath": [
                "home/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino",
                "home/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/micro",
                "/home/Arduino/libraries/src",
                "/home/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/lib/gcc/avr/7.3.0/include",
                "/home/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/lib/gcc/avr/7.3.0/include-fixed",
                "/home/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/avr/include"
            ],
            "forcedInclude": [
                "/home/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/Arduino.h"
            ],
            "cStandard": "c11",
            "cppStandard": "c++14",
            "defines": [
...
"__cplusplus=201402L", 
...

The error gets thrown in the sml.hpp file

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

Any help is appreciated.

Best regards

Edit

My tasks.json for avr-g++ :

"version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: avr-g++ build active file",
            "command": "/home/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",
                "-w",
                "-std=c++14",
                "-fpermissive",
                "-fno-exceptions",
                "-ffunction-sections",
                "-fdata-sections",
                "-fno-threadsafe-statics",
                "-Wno-error=narrowing"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: /home/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++"
        }
    ]
}
πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
orfvl
  • 111
  • 5

1 Answers1

2

After looking at the option. I found the build preferences: I added following flag to the arduino.json:

{
"board": "arduino:avr:micro",
"programmer": "avrisp",
"port": "/dev/ttyACM0",
"output": "../build",
"sketch": "test.ino",
"intelliSenseGen": "global",
"buildPreferences": [
    ["build.extra_flags", "-std=c++14"]
]
orfvl
  • 111
  • 5