I am getting the following error after I attempt to break out a function definition from a header file I wrote:
o: In function `readBytes()':
undefined reference to `add_byte(byte_array*, unsigned char)'
The header file (byte_array_s.h) looks like this:
#ifndef _byte_array_h
#define _byte_array_h
#include <WProgram.h>
typedef struct byte_array {
byte *data; // array of bytes this struct is meant to represent
int size; // number of bytes the structure possesses
int bitsRead; // number of bits contained in the structure (this is different than 8 * size)
} byte_array_s;
void add_byte(byte_array_s *byteArray, const byte _byte);
#endif
And this is the code that is throwing the error (currentByte is of type 'byte' and byteArray is a pointer to a byte_array_s BTW):
#include "byte_array_s.h"
...
byte_array_s * readBytes() {
...
if(bitCounter != 0) add_byte(byteArray, currentByte);
...
}
Can anyone tell me what I am doing wrong? Is the definition not defined properly?