I am building my Arduino project with a makefile:
BOARD_TAG = uno
ARDUINO_PORT = /dev/ttyACM0
USER_LIB_PATH = /home/prakhar/dev/alfred/arduino/libraries
CPPFLAGS=-x c++ -std=c++11 -Wall -DUNIX_ENVIRONMENT -DHAVE_NAMESPACES -DHAVE_STD
include /usr/share/arduino/Arduino.mk
I keep getting this error:
cc1plus: error: unrecognized command line option "-std=c++11"
I googled and this says that I need to update g++/gcc. I already have the newset versions:
prakhar@sim74stic ~ $ avr-g++ --version
avr-g++ (GCC) 4.9.1
Copyright (C) 2014 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.
prakhar@sim74stic ~ $ avr-gcc --version
avr-gcc (GCC) 4.9.1
Copyright (C) 2014 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.
prakhar@sim74stic ~ $ g++ --version
g++ (GCC) 4.9.1 20140903 (prerelease)
Copyright (C) 2014 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.
I installed arduino
from the AUR
(packages aur/arduino 1:1.0.6-1
and aur/arduino-mk 1.3.4-2
).
Can anybody point out what I'm doing wrong?
-
1Check out the first few comments here: aur.archlinux.org/packages/arduino It may help.geometrikal– geometrikal2014年10月04日 12:56:36 +00:00Commented Oct 4, 2014 at 12:56
-
Thanks for pointing me in the right direction. I C++11 to work.xyz– xyz2014年10月04日 15:47:51 +00:00Commented Oct 4, 2014 at 15:47
1 Answer 1
As I turns out, the avr-gcc (GCC) 4.9.1
goodies weren't being used at all! The arduino package was using a decrepit version of gcc,
prakhar@sim74stic ~ $ /usr/share/arduino/hardware/tools/avr/bin/avr-g++ --version
avr-g++ (GCC) 4.3.2
Copyright (C) 2008 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.
prakhar@sim74stic ~ $ /usr/share/arduino/hardware/tools/avr/bin/avr-gcc --version
avr-gcc (GCC) 4.3.2
Copyright (C) 2008 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.
All I had to do was specify:
AVR_TOOLS_DIR = /usr
to exexute with -std=c++11
flag (I also had to add an -fpermissive
flag to compile C
with g++
).