I'm building a library based on Allegro for my commonly used code. The compile works, but when the linker kicks in I'm given an error message that one of the functions it contains cannot be found. Have I overlooked something here?
Here's an overview of the code:
Library
jlib/jlib.h
Code:
void increment_global_timer();
void init_global_timer();
jlib/jlib.c
Code:
#include <allegro.h>
#include "jtimer.h" // only contains 'int init();'
volatile int global_timer;
void increment_global_timer()
// [ place another frame onto the stack ] //
{
++global_timer;
}
END_OF_FUNCTION (increment_global_timer);
// [ setup the global timer ] //
void init_global_timer()
{
LOCK_VARIABLE(global_timer);
LOCK_FUNCTION(increment_global_timer);
install_int_ex(increment_global_timer, BPS_TO_TIMER(60));
// [ randomise ] //
srand ((unsigned int)time(NULL));
}
jlib.h
Code:
#include "jlib/jtimer.h"
Game
Code:
#include <allegro.h>
#include <jlib.h>
#include "init.h"
#include "maps.h"
int init()
{
allegro_init();
install_timer();
install_keyboard();
init_global_timer();
init_maps();
}
Error
[Linker error] undefined reference to `init_global_timer'
Cheers.