Go Down

Topic: Really basic STL question (Read 1 time) previous topic - next topic

skyjumper

Hi All...

I have installed Andy's Arduino 1.0 STL implementation as described:

http://andybrown.me.uk/ws/2011/01/15/the-standard-template-library-stl-for-avr-with-c-streams/

I can't get the worlds simplest code below to compile. Is there a trick I'm missing? I removed the bottom bunch of errors so the message would not be too long to post here.

Thanks...

Code: [Select]

#include <vector>

void setup()
{
 vector<int> jimsVector(5);
}

void loop() {}


Quote

C:\Users\jim\Desktop\arduino-1.0\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -IC:\Users\jim\Desktop\arduino-1.0\hardware\arduino\cores\arduino -IC:\Users\jim\Desktop\arduino-1.0\hardware\arduino\variants\standard C:\Users\jim\AppData\Local\Temp\build7089832463956870848.tmp\STL_Test.cpp -oC:\Users\jim\AppData\Local\Temp\build7089832463956870848.tmp\STL_Test.cpp.o
In file included from c:/users/jim/desktop/arduino-1.0/hardware/tools/avr/lib/gcc/../../avr/include/stl_algobase.h:64,
                from c:/users/jim/desktop/arduino-1.0/hardware/tools/avr/lib/gcc/../../avr/include/vector:31,
                from STL_Test.cpp:1:
c:/users/jim/desktop/arduino-1.0/hardware/tools/avr/lib/gcc/../../avr/include/stl_iterator.h:589: error: expected type-specifier before 'char_traits'
c:/users/jim/desktop/arduino-1.0/hardware/tools/avr/lib/gcc/../../avr/include/stl_iterator.h:589: error: expected '>' before 'char_traits'
c:/users/jim/desktop/arduino-1.0/hardware/tools/avr/lib/gcc/../../avr/include/stl_iterator.h:595: error: expected ';' before '<' token
c:/users/jim/desktop/arduino-1.0/hardware/tools/avr/lib/gcc/../../avr/include/stl_iterator.h:599: error: '_Dist' does not name a type
c:/users/jim/desktop/arduino-1.0/hardware/tools/avr/lib/gcc/../../avr/include/stl_iterator.h:604: error: expected `)' before '&' token
c:/users/jim/desktop/arduino-1.0/hardware/tools/avr/lib/gcc/../../avr/include/stl_iterator.h:623: error: expected ';' before '*' token


skyjumper

My bad...

This needs <iterator> included as well...

Code: [Select]

#include <iterator>
#include <vector>

using namespace std;

void setup()
{
  vector<int> jimsVector(5);
}

void loop() {}


Go Up