Undefined Reference in AVR Studio

Thread Starter


Joined Apr 27, 2009
Hi there.
I am trying to include a couple of .c files which I have already written for a previous project.

#include "lib\gpslib.h"
#include "lib\i2cmaster.h"
#include "lib\usart.h"

As they are sitting in the /lib folder relative to the primary .c file for the project. However, when I try to compile it gives the following error:

C:\Users\vincent\Documents\AVR\Contiki\default/../Contiki.c:145: undefined reference to `i2c_start_wait'

Where i2c_start_wait is a function defined within the i2cmaster.h and .s files.

It also has a bunch of similar errors relating to other functions within i2cmaster.h, gpslib.h, and usart.h - it cannot find a single function within any of these /lib files for some reason.

I have also tried including them through:

#include <usart.h>

where the library path is added to AVR Studio, however this causes the same error. It is asif the compiler can find the files, but it cannot link correctly between the two?

Any help would be much appreciated.