Offline
Edison Member
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
|
 |
« on: March 06, 2012, 06:20:25 pm » |
Hi all, I guess it's my turn to be the one asking questions :-P I wanted to try the STL library ported by Andy Brown. http://www.gammon.com.au/forum/?id=11119http://arduino.cc/forum/index.php/topic,77555.0.htmlhttp://andybrown.me.uk/ws/2011/01/15/the-standard-template-library-stl-for-avr-with-c-streams/The instructions on Andy's blog mentioned a pre-1.0 version of Arduino. I tried to use the lib under Arduino 1.0, though. My platform is Ubuntu 11.10 x64. I managed to make Arduino see stl's .h file by putting them in /usr/lib/avr/include/. In fact, to keep things clean, I copied Andy's .h in /usr/lib/avr/include/avr-stl, and symlinked its contents one by one to /usr/lib/avr/include/. This last bit should not make any difference, though... When I compile a "bare minimum" with just one include I get many errors. I have activated the "verbose compilation" option. Sketch: // stl test
#include <vector>
void setup() { }
void loop() { }
Compilation errors: avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I/home/marcello/Software/arduino-1.0/hardware/arduino/cores/arduino -I/home/marcello/Software/arduino-1.0/hardware/arduino/variants/standard /tmp/build8593065707036368931.tmp/BareMinimum.cpp -o/tmp/build8593065707036368931.tmp/BareMinimum.cpp.o In file included from /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_algobase.h:64:0, from /usr/lib/gcc/avr/4.5.3/../../../avr/include/vector:31, from BareMinimum.cpp:3: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:589:48: error: expected type-specifier before ‘char_traits’ /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:589:48: error: expected ‘>’ before ‘char_traits’ /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:595:11: error: ‘basic_istream’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:599:11: error: ‘_Dist’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:604:32: error: expected ‘)’ before ‘&’ token /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:623:3: error: ‘istream_type’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: In constructor ‘std::istream_iterator<_Tp, _CharT, _Traits>::istream_iterator()’: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:603:24: error: class ‘std::istream_iterator<_Tp, _CharT, _Traits>’ does not have any field named ‘_M_stream’ /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: In member function ‘bool std::istream_iterator<_Tp, _CharT, _Traits>::_M_equal(const std::istream_iterator<_Tp, _CharT, _Traits>&) const’: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:620:49: error: ‘_M_stream’ was not declared in this scope /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: In member function ‘void std::istream_iterator<_Tp, _CharT, _Traits>::_M_read()’: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:628:14: error: ‘_M_stream’ was not declared in this scope /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: At global scope: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:638:62: error: wrong number of template arguments (4, should be 3) /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:591:7: error: provided for ‘template<class _Tp, class _CharT, class _Traits> class std::istream_iterator’ /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:639:62: error: wrong number of template arguments (4, should be 3) /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:591:7: error: provided for ‘template<class _Tp, class _CharT, class _Traits> class std::istream_iterator’ /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:639:68: error: ‘bool std::operator==(const int&, const int&)’ must have an argument of class or enumerated type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:647:62: error: wrong number of template arguments (4, should be 3) /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:591:7: error: provided for ‘template<class _Tp, class _CharT, class _Traits> class std::istream_iterator’ /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:648:62: error: wrong number of template arguments (4, should be 3) /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:591:7: error: provided for ‘template<class _Tp, class _CharT, class _Traits> class std::istream_iterator’ /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:648:68: error: ‘bool std::operator!=(const int&, const int&)’ must have an argument of class or enumerated type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:655:48: error: expected type-specifier before ‘char_traits’ /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:655:48: error: expected ‘>’ before ‘char_traits’ /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:660:11: error: ‘basic_ostream’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:668:32: error: expected ‘)’ before ‘&’ token /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:669:32: error: expected ‘)’ before ‘&’ token /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:671:23: error: template argument 3 is invalid /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:676:23: error: template argument 3 is invalid /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:677:23: error: template argument 3 is invalid /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:678:23: error: template argument 3 is invalid /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:680:3: error: ‘ostream_type’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: In member function ‘int& std::ostream_iterator<_Tp, _CharT, _Traits>::operator=(const _Tp&)’: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:672:6: error: ‘_M_stream’ was not declared in this scope /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: At global scope: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:699:11: error: ‘basic_streambuf’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:700:11: error: ‘basic_istream’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:703:37: error: expected ‘)’ before ‘*’ token /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:704:35: error: expected ‘)’ before ‘&’ token /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:725:16: error: ‘streambuf_type’ has not been declared /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:750:3: error: ‘streambuf_type’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: In member function ‘void std::istreambuf_iterator<_CharT, _Traits>::_M_init(int*)’: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:726:5: error: ‘_M_buf’ was not declared in this scope /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: In member function ‘void std::istreambuf_iterator<_CharT, _Traits>::_M_nextc()’: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:736:20: error: ‘_M_buf’ was not declared in this scope /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: In member function ‘void std::istreambuf_iterator<_CharT, _Traits>::_M_getc() const’: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:743:20: error: ‘_M_buf’ was not declared in this scope /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: At global scope: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:806:11: error: ‘basic_streambuf’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:807:11: error: ‘basic_ostream’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:810:37: error: expected ‘)’ before ‘*’ token /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:811:35: error: expected ‘)’ before ‘&’ token /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:827:3: error: ‘streambuf_type’ does not name a type /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h: In member function ‘std::ostreambuf_iterator<_CharT, _Traits>& std::ostreambuf_iterator<_CharT, _Traits>::operator=(char_type)’: /usr/lib/gcc/avr/4.5.3/../../../avr/include/stl_iterator.h:815:48: error: ‘_M_buf’ was not declared in this scope
Any pointers ? Thank you in advance! (edit: added reference to Nick's page)
|
|
|
|
« Last Edit: March 06, 2012, 09:30:02 pm by tuxduino »
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #1 on: March 06, 2012, 06:58:33 pm » |
I mention on my page you need to include "iterator" or you will get errors. Which you did. This compiles under 1.0 of the IDE: // stl test
#include <iterator> #include <vector>
void setup() { }
void loop() { }
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #2 on: March 06, 2012, 07:21:44 pm » |
Now let's take it out for a drive ... // stl test
#include <iterator> #include <string> #include <vector> #include <serstream>
using namespace std;
ohserialstream serial(Serial); // placement new void * operator new (size_t size, void * ptr) { return ptr; }
void showv (const string s, const vector<string> & v) { serial << s << endl; copy(v.begin(), v.end(), ostream_iterator<string>(serial, " ")); serial << endl << endl; } // end of showv // case-independent (ci) string less_than // returns true if s1 < s2 struct ci_less : binary_function<string, string, bool> {
// case-independent (ci) compare_less binary function struct nocase_compare : public binary_function<unsigned char,unsigned char,bool> { bool operator() (const unsigned char& c1, const unsigned char& c2) const { return tolower (c1) < tolower (c2); } };
bool operator() (const string & s1, const string & s2) const { return lexicographical_compare (s1.begin (), s1.end (), // source range s2.begin (), s2.end (), // dest range nocase_compare ()); // comparison } }; // end of ci_less
void setup() { Serial.begin (115200); // vector of strings vector<string> v;
// make a back insert iterator to safely add to the back of the vector back_insert_iterator<vector<string> > i(v); // Insert items into the vector. // Strictly speaking, the "++" is not needed, as the // assignment to the iterator is what advances it.
*i++ = "The"; *i++ = "quick"; *i++ = "brown"; *i++ = "fox"; *i++ = "jumped"; *i++ = "over"; *i++ = "the"; *i++ = "lazy"; *i++ = "dog";
showv ("initial vector...", v);
// sort ascending sort (v.begin (), v.end ()); showv ("after sort (ascending)...", v);
// sort descending by using greater function to compare less sort (v.begin (), v.end (), greater<string> ()); showv ("after sort (descending)...", v);
// sort case-independent by using our own compare-less sort (v.begin (), v.end (), ci_less ()); showv ("after case-independent sort (ascending)...", v);
// reverse that by doing a "not" on the result sort (v.begin (), v.end (), not2 (ci_less ())); showv ("after case-independent sort (descending)...", v); // shuffle the words random_shuffle (v.begin (), v.end ()); showv ("after shuffle...", v);
// rotate them rotate (v.begin (), v.begin () + 1, v.end ()); showv ("after rotate 1 to the left...", v);
// reverse their order reverse (v.begin (), v.end ()); showv ("after reverse...", v);
// add "(" to the beginning of each one transform (v.begin (), v.end (), v.begin (), bind1st (plus<string> (), "("));
// add ")" to the end of each one transform (v.begin (), v.end (), v.begin (), bind2nd (plus<string> (), ")")); showv ("after transforms...", v);
} // end of setup
void loop() { }
(Edit) Modified to use the serstream class rather than Serial.print.
Output: initial vector... The quick brown fox jumped over the lazy dog
after sort (ascending)... The brown dog fox jumped lazy over quick the
after sort (descending)... the quick over lazy jumped fox dog brown The
after case-independent sort (ascending)... brown dog fox jumped lazy over quick the The
after case-independent sort (descending)... The the quick over lazy jumped fox dog brown
after shuffle... dog over brown the lazy quick The fox jumped
after rotate 1 to the left... over brown the lazy quick The fox jumped dog
after reverse... dog jumped fox The quick lazy the brown over
after transforms... (dog) (jumped) (fox) (The) (quick) (lazy) (the) (brown) (over)
Note that I also needed to include "placement new" to make it compile. Funnily enough I made a post in another thread today about how they included new and delete in the 1.0 version of the IDE but not placement new. <sigh>
|
|
|
|
« Last Edit: March 06, 2012, 07:55:52 pm by Nick Gammon »
|
Logged
|
|
|
|
|
Seattle, WA
Offline
God Member
Karma: 4
Posts: 673
|
 |
« Reply #3 on: March 06, 2012, 07:29:10 pm » |
I also have a different take on the STL, having ported uClibc++ to Arduino: https://github.com/maniacbug/StandardCplusplusWorks with 1.0, and uses Andy Brown's excellent serstream class.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #4 on: March 06, 2012, 07:42:27 pm » |
So what's the difference between your version and Andy Brown's?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
|
 |
« Reply #5 on: March 06, 2012, 09:29:22 pm » |
I mention on my page you need to include "iterator" or you will get errors. Which you did. This compiles under 1.0 of the IDE: // stl test
#include <iterator> #include <vector>
void setup() { }
void loop() { } Damn! I read that bit but then forgot about it while trying to find a place for the lib... thank you! 
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA
Offline
God Member
Karma: 4
Posts: 673
|
 |
« Reply #6 on: March 06, 2012, 10:43:52 pm » |
So what's the difference between your version and Andy Brown's?
Andy started with the original SGI STL, and did some more work to optimize for very low memory. I started with uClibc++ which itself is a port of the more modern GNU Standard C++. The differences are pretty esoteric. Most code that uses Standard C++ will port more easily using my stuff. This is why I brought it over in the first place. The unit test framework I use (cxxtest) needed a fuller implementation. His probably generates a bit tighter code just from the looks of it, though I haven't profiled it.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #7 on: May 02, 2012, 06:32:26 am » |
Hi, I do also use the STL of Andy and get compiler errors which I do not understand. Maybe sb else sees the error? I do not understand why he has problems with the iterator... Thanks for any tips! My Code looks like this: //parser_event.ino #include <vector> #include <iterator> #include <pnew.cpp> .... std::vector<Event> *events; //holds all events void sampleMethod() { ... Event *myEvent = events[i]; //.at(i); did not work ... } Results in (no specific line is marked in the IDE): In file included from <path>avr/lib/gcc/../../avr/include/stl_algobase.h:64, from <path>avr/lib/gcc/../../avr/include/vector:31, from parser_event.cpp:5: <path>avr/lib/gcc/../../avr/include/stl_iterator.h:589: error: expected type-specifier before 'char_traits' <path>avr/lib/gcc/../../avr/include/stl_iterator.h:589: error: expected '>' before 'char_traits' <path>avr/lib/gcc/../../avr/include/stl_iterator.h:595: error: expected ';' before '<' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:599: error: '_Dist' does not name a type <path>avr/lib/gcc/../../avr/include/stl_iterator.h:604: error: expected `)' before '&' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:623: error: expected ';' before '*' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h: In constructor 'std::istream_iterator<_Tp, _CharT, _Traits>::istream_iterator()': <path>avr/lib/gcc/../../avr/include/stl_iterator.h:603: error: class 'std::istream_iterator<_Tp, _CharT, _Traits>' does not have any field named '_M_stream' <path>avr/lib/gcc/../../avr/include/stl_iterator.h: In member function 'bool std::istream_iterator<_Tp, _CharT, _Traits>::_M_equal(const std::istream_iterator<_Tp, _CharT, _Traits>&) const': <path>avr/lib/gcc/../../avr/include/stl_iterator.h:620: error: '_M_stream' was not declared in this scope <path>avr/lib/gcc/../../avr/include/stl_iterator.h: In member function 'void std::istream_iterator<_Tp, _CharT, _Traits>::_M_read()': <path>avr/lib/gcc/../../avr/include/stl_iterator.h:628: error: '_M_stream' was not declared in this scope <path>avr/lib/gcc/../../avr/include/stl_iterator.h: At global scope: <path>avr/lib/gcc/../../avr/include/stl_iterator.h:638: error: wrong number of template arguments (4, should be 3) <path>avr/lib/gcc/../../avr/include/stl_iterator.h:591: error: provided for 'template<class _Tp, class _CharT, class _Traits> class std::istream_iterator' <path>avr/lib/gcc/../../avr/include/stl_iterator.h:639: error: wrong number of template arguments (4, should be 3) <path>avr/lib/gcc/../../avr/include/stl_iterator.h:591: error: provided for 'template<class _Tp, class _CharT, class _Traits> class std::istream_iterator' <path>avr/lib/gcc/../../avr/include/stl_iterator.h:639: error: 'bool std::operator==(const int&, const int&)' must have an argument of class or enumerated type <path>avr/lib/gcc/../../avr/include/stl_iterator.h:647: error: wrong number of template arguments (4, should be 3) <path>avr/lib/gcc/../../avr/include/stl_iterator.h:591: error: provided for 'template<class _Tp, class _CharT, class _Traits> class std::istream_iterator' <path>avr/lib/gcc/../../avr/include/stl_iterator.h:648: error: wrong number of template arguments (4, should be 3) <path>avr/lib/gcc/../../avr/include/stl_iterator.h:591: error: provided for 'template<class _Tp, class _CharT, class _Traits> class std::istream_iterator' <path>avr/lib/gcc/../../avr/include/stl_iterator.h:648: error: 'bool std::operator!=(const int&, const int&)' must have an argument of class or enumerated type <path>avr/lib/gcc/../../avr/include/stl_iterator.h:655: error: expected type-specifier before 'char_traits' <path>avr/lib/gcc/../../avr/include/stl_iterator.h:655: error: expected '>' before 'char_traits' <path>avr/lib/gcc/../../avr/include/stl_iterator.h:660: error: expected ';' before '<' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:668: error: expected `)' before '&' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:669: error: expected `)' before '&' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:671: error: template argument 3 is invalid <path>avr/lib/gcc/../../avr/include/stl_iterator.h:676: error: template argument 3 is invalid <path>avr/lib/gcc/../../avr/include/stl_iterator.h:677: error: template argument 3 is invalid <path>avr/lib/gcc/../../avr/include/stl_iterator.h:678: error: template argument 3 is invalid <path>avr/lib/gcc/../../avr/include/stl_iterator.h:680: error: expected ';' before '*' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h: In member function 'int& std::ostream_iterator<_Tp, _CharT, _Traits>::operator=(const _Tp&)': <path>avr/lib/gcc/../../avr/include/stl_iterator.h:672: error: '_M_stream' was not declared in this scope <path>avr/lib/gcc/../../avr/include/stl_iterator.h: At global scope: <path>avr/lib/gcc/../../avr/include/stl_iterator.h:699: error: expected ';' before '<' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:700: error: expected ';' before '<' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:703: error: expected `)' before '*' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:704: error: expected `)' before '&' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:725: error: 'streambuf_type' has not been declared <path>avr/lib/gcc/../../avr/include/stl_iterator.h:750: error: expected ';' before '*' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h: In member function 'void std::istreambuf_iterator<_CharT, _Traits>::_M_init(int*)': <path>avr/lib/gcc/../../avr/include/stl_iterator.h:726: error: '_M_buf' was not declared in this scope <path>avr/lib/gcc/../../avr/include/stl_iterator.h: In member function 'void std::istreambuf_iterator<_CharT, _Traits>::_M_nextc()': <path>avr/lib/gcc/../../avr/include/stl_iterator.h:736: error: '_M_buf' was not declared in this scope <path>avr/lib/gcc/../../avr/include/stl_iterator.h: In member function 'void std::istreambuf_iterator<_CharT, _Traits>::_M_getc() const': <path>avr/lib/gcc/../../avr/include/stl_iterator.h:743: error: '_M_buf' was not declared in this scope <path>avr/lib/gcc/../../avr/include/stl_iterator.h: At global scope: <path>avr/lib/gcc/../../avr/include/stl_iterator.h:806: error: expected ';' before '<' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:807: error: expected ';' before '<' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:810: error: expected `)' before '*' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:811: error: expected `)' before '&' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h:827: error: expected ';' before '*' token <path>avr/lib/gcc/../../avr/include/stl_iterator.h: In member function 'std::ostreambuf_iterator<_CharT, _Traits>& std::ostreambuf_iterator<_CharT, _Traits>::operator=(_CharT)': <path>avr/lib/gcc/../../avr/include/stl_iterator.h:815: error: '_M_buf' was not declared in this scope
Note: I replaced a part of the filepath with <path> here for better readability P.s.: Should I have opend another Thread for this?
|
|
|
|
|
Logged
|
|
|
|
|
Essex, UK
Offline
Full Member
Karma: 4
Posts: 149
Arduino rocks
|
 |
« Reply #8 on: May 02, 2012, 06:46:29 am » |
@milkman
Change around the order of your includes for vector and iterator so that iterator comes first.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #9 on: May 02, 2012, 06:53:59 am » |
Change around the order of your includes for vector and iterator so that iterator comes first.
Holy Moly! I really searched for quite a long time for a solution - thank you very much Andy! Is there clue in the error msgs of gcc/ anything general with C(++) to find a solution for such a problem in general. I mean: how to find out what's wrong in such a case? Is it 'magic knowledge' or anything obious? Thanks again 
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #10 on: May 02, 2012, 03:37:57 pm » |
The clue is here: In file included from <path>avr/lib/gcc/../../avr/include/stl_algobase.h:64, from <path>avr/lib/gcc/../../avr/include/vector:31, from parser_event.cpp:5: <path>avr/lib/gcc/../../avr/include/stl_iterator.h:589: error: expected type-specifier before 'char_traits' Apart from your own code the first error is raised from <vector> (2nd line above) and it mentions something to do with "stl_iterator". And in particular "expected type-specifier ". So I would be thinking: "when it is processing <vector> it doesn't seem to know about <iterator> ... perhaps I should put iterator first."
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #11 on: May 03, 2012, 02:04:38 am » |
[...] So I would be thinking: "when it is processing <vector> it doesn't seem to know about <iterator> ... perhaps I should put iterator first."
Thank you very much for your explaination! Good points, next time I'll try to read the error messages in such a way. 
|
|
|
|
|
Logged
|
|
|
|
|
|