Also just FYI... when you include a file it normally has the .h extension. The code you posted just said #include but should have been #include <vector.h> had you indeed installed the library.
Also just FYI... when you include a file it normally has the .h extension. The code you posted just said #include but should have been #include <vector.h> had you indeed installed the library.
Ok, thanks!
When I use vector in eclipse, I am able to just include vector, and not the h file, good to know.
Can any c++ library be brought into arduino? Or does something have to be done to do so?
NJavrGuy:
Can any c++ library be brought into arduino? Or does something have to be done to do so?
It really depends on the library. If you read the link I posted on the STL port you will see he had to do a bit of work to get things to work. Something simple might be a straight port while others might be quite impossible with the limited memory one must work with.
Oh and let me correct myself, normally libraries end with .h. I thought his port for the vector library had .h on the end but according to the sample code on his website I was mistaken.
NJavrGuy:
Can any c++ library be brought into arduino? Or does something have to be done to do so?
It really depends on the library. If you read the link I posted on the STL port you will see he had to do a bit of work to get things to work. Something simple might be a straight port while others might be quite impossible with the limited memory one must work with.
Oh and let me correct myself, normally libraries end with .h. I thought his port for the vector library had .h on the end but according to the sample code on his website I was mistaken.
If, by "vector", you mean an array with dynamic length, then it is unlikely to be useful on the Arduino.
Dynamically allocated memory does not work very well on the arduino.
You'd be better advised to learn to do with it, and implement your project another way.
If you follow the link to Andy Brown's port of the STL, you can have that going fairly easily. You need to copy quite a few files as described on his page.
However as others are pointing out, the STL uses dynamic memory allocation, and you don't have a heap of free memory on the Arduino. Plus currently the free() function has a bug, which you can correct by following this link:
michinyon:
If, by "vector", you mean an array with dynamic length, then it is unlikely to be useful on the Arduino.
Dynamically allocated memory does not work very well on the arduino.
You'd be better advised to learn to do with it, and implement your project another way.