0

I'm trying to compile a sketch that uses the following code:

std::function<void(char*)> callback = std::bind(&Animator::_callback, this, std::placeholders::_1);

Verification of the sketch fails with the following error:

In file included from /var/folders/4l/d1rq54rx1lz09xh1xy4f8rm00000gn/T/arduino_build_705493/sketch/Animator.cpp:1:0: Animator.h:22: error: 'function' in namespace 'std' does not name a template type

This kind of error would seem to show up when you use a version of gcc prior to 4.7 which added support for c++11 features.

The compilation flags that the IDE uses are:

"..Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10805 -DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD -DARDUINO_SAMD_ZERO -DARM_MATH_CM0PLUS -DADAFRUIT_FEATHER_M0 -D__SAMD21G18A__ -DUSB_VID=0x239A -DUSB_PID=0x800B -DUSBCON '-DUSB_MANUFACTURER="Adafruit"' '-DUSB_PRODUCT="Feather M0"' "-I..Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/" "-I..Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/" "-I..Arduino15/packages/adafruit/hardware/samd/1.2.1/cores/arduino" "-I..Arduino15/packages/adafruit/hardware/samd/1.2.1/variants/feather_m0" "-I..Arduino15/packages/adafruit/hardware/samd/1.2.1/libraries/SPI" "-I../Arduino/libraries/PubSubClient/src" "-I../Arduino/libraries/WiFi101/src" "-I../Arduino/libraries/Adafruit_NeoPixel" "/var/folders/4l/d1rq54rx1lz09xh1xy4f8rm00000gn/T/arduino_build_705493/sketch/Animator.cpp" -o "/var/folders/4l/d1rq54rx1lz09xh1xy4f8rm00000gn/T/arduino_build_705493/sketch/Animator.cpp.o"

Including -std=gnu++11 which would make me think that it should have support for cpp++11?

Using Arduino IDE 1.8.5, and the Arduino SAMD Boards 1.6.18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.