Closed jefferai closed 1 year ago
Oh, I'm using Atmel's official toolchain: gcc version 4.6.2 (AVR_8_bit_GNU_Toolchain_3.4.0_663)
I had this issue when I only had:
I then added the rest of the header files listed in the string-vector example and no longer saw this error message.
Hi! I have the exact same error message and ryantucks tip didn't work. I have all includes of the string-vector example in my test program :-/
I have tried again and I can't even get the example to work the ŕesult is always:
/home/vidar/sketchbook/libraries/StandardCplusplus/cstdlib:60: error: expected unqualified-id before ‘long’
/home/vidar/sketchbook/libraries/StandardCplusplus/cstdlib:60: error: expected )' before ‘long’ /home/vidar/sketchbook/libraries/StandardCplusplus/cstdlib:60: error: expected
)' before ‘long’
I would really like to use this lib though :-/
This is because the builtin Arduino.h
contains the line #define abs ...
, which then ruins the function definition.
This is fixed with #include "StandardCplusplus.h"
at the top of all your files, although arguably #undef abs
should appear within cstdlib
.
I include Arduino.h
after including another C++ library like std::vector and this issue is fixed.
Hi there,
GH-34 has a fix for this, as suggested by @eric-wieser -- thanks! We are hosting a working version at ^1 on behalf of the next
branch. Pulling in the StandardCplusplus
library by using a PlatformIO configuration like outlined below works for us.
With kind regards, Andreas.
[platformio]
src_dir = .
[env:atmega328p]
platform = atmelavr@^2
board = uno
framework = arduino
lib_deps =
https://github.com/hiveeyes/StandardCplusplus#next
Merged #34 which fixes this. Thanks!
Wow. Fun to see my bug from 11 years ago get closed! Just a lovely unexpected GitHub notification.
I'm trying to use this library and hitting a problem. Below is the (verbose) output. I did notice that the StandardCplusplus.h include does an #undef abs, which I'm assuming is related to this, but including that file or not made no difference in my project. Any ideas?...thanks in advance.
[ 68%] Building CXX object CMakeFiles/hub.dir/src/main.cpp.obj /home/jmitchell/Arduino/avr8-gnu-toolchain-linux_x86_64/bin/avr-g++ -DUBRRH -DUBRR0H -DUBRR1H -DUBRR2H -DUBRR3H -DDEBUG_K=1 -g -Os -mcall-prologues -ffunction-sections -fdata-sections -fno-exceptions -I/home/jmitchell/Arduino/libraries/Arduino-Style/StandardCplusplus -I/home/jmitchell/Arduino/libraries/messaging -I/home/jmitchell/Arduino/arduino-1.0.1/libraries -I/home/jmitchell/Arduino/arduino-1.0.1/hardware/arduino/variants/mega -DF_CPU=16000000L -DARDUINO=100 -mmcu=atmega2560 -I/home/jmitchell/Arduino/arduino-1.0.1/hardware/arduino/cores/arduino -I/home/jmitchell/Arduino/arduino-1.0.1/libraries -I/home/jmitchell/Arduino/arduino-1.0.1/hardware/arduino/variants/mega -I/home/jmitchell/Arduino/libraries/Arduino-Style/SoftwareSerial -I/home/jmitchell/Arduino/arduino-1.0.1/libraries/Wire -I/home/jmitchell/Arduino/libraries/Arduino-Style/Usb -I/home/jmitchell/Arduino/libraries/Arduino-Style/AndroidAccessory -I/home/jmitchell/Arduino/libraries/Arduino-Style/DebugPrint -I/home/jmitchell/Arduino/libraries/Arduino-Style/Time -o CMakeFiles/hub.dir/src/main.cpp.obj -c /home/jmitchell/Arduino/applications/hub/src/main.cpp In file included from /home/jmitchell/Arduino/libraries/Arduino-Style/StandardCplusplus/memory:22:0, from /home/jmitchell/Arduino/libraries/Arduino-Style/StandardCplusplus/char_traits:22, from /home/jmitchell/Arduino/libraries/Arduino-Style/StandardCplusplus/iosfwd:21, from /home/jmitchell/Arduino/libraries/Arduino-Style/StandardCplusplus/iterator:21, from /home/jmitchell/Arduino/applications/hub/src/main.cpp:32: /home/jmitchell/Arduino/libraries/Arduino-Style/StandardCplusplus/cstdlib:60:14: error: expected unqualified-id before 'long' /home/jmitchell/Arduino/libraries/Arduino-Style/StandardCplusplus/cstdlib:60:14: error: expected ')' before 'long' /home/jmitchell/Arduino/libraries/Arduino-Style/StandardCplusplus/cstdlib:60:14: error: expected ')' before 'long'