LoginSignup
2
0

More than 5 years have passed since last update.

PlatformIO での avr コンパイル時に C++11 を指定する

Posted at

Arduino 開発で C++11 の機能を使いたいことが時たまある。

2015年12月現在、toolchain-atmelavr に含まれる avr-gcc のバージョンは 4.8.1 なため、C++11 を使うためには明示的にコンパイルオプションで指定する必要がある。

$ ~/.platformio/packages/toolchain-atmelavr/bin/avr-gcc --version
avr-gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

PlatformIO では platformio.ini の build_flags か、環境変数の PLATFORMIO_BUILD_FLAGS で指定してやる。

plaftormio.ini
build_flags = -std=c++11

これで C++11 の指定付きでコンパイルされ、利用できる様になった。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0