Getting libraries to work

I just installed arduino-0004 and am having trouble getting custom libraries to work. I wrote one of my own and was having trouble, so I went back to basics and tried to use the Matrix library that’s included with the package. Here is the code:

#include <Matrix.h>

void setup() 

void loop()

Notice that I am not doing anything witht the library in the code… I just include it. When I compile, I get this:

lib\targets\libraries\Matrix\Matrix.o: In function `Matrix::write(unsigned char, unsigned char, Sprite)’:

/cygdrive/c/Documents and Settings/davin/My Documents/electronics/arduino-0004/lib\targets\libraries\Matrix\Matrix.cpp:202: undefined reference to `Sprite::read(unsigned char, unsigned char) const’

/cygdrive/c/Documents and Settings/davin/My Documents/electronics/arduino-0004/lib\targets\libraries\Matrix\Matrix.cpp:201: undefined reference to `Sprite::width() const’

/cygdrive/c/Documents and Settings/davin/My Documents/electronics/arduino-0004/lib\targets\libraries\Matrix\Matrix.cpp:200: undefined reference to `Sprite::height() const’

It seems like OTHER libraries (in this case Sprite) that the library uses are not getting included in the linker script. I get a similar effect with my custom library, but in this case I can call the class constructor of the class that I am defining in my cpp file, but then when I try to actually call a method within that class it gives me the same “undefined reference to…” error.

Help? Thanks!

You're right about the Matrix case: you also need to include the Sprite library as we don't yet have a system for automatically handling library dependencies.

The issue with your custom library sounds like it might be different. Can you post the code (or a simpler version with the same problem)?

Hm... i'm still in the process of figuring it out, but it seems like when the library is edited, the .o file needs to be deleted manually before the sketch is compiled in Ardunio. When I manually delete it, the compile work OK. Does the IDE compile the libraries only on launch or does it recompile them every time the sketch is compiled?

Every time a sketch is compiled, if you've deleted the library's .o file.