I just added a function (addToMsgQueue) to one of my sourcefiles (messaging.c) and to its header (messaging.h), compiled into a shared library, and now am trying to compile a third file - matchingengine.c - which includes messaging.h. Until I added this new function everything worked fine. Now my compiler gives me "undefined reference to 'addToMsgQueue' ". I cannot get it to compile and don't know where to look for anymore.
here I what is I hope, the relevant code
Code:
here I define the function in messaging.c
---------------------------------------
void addToMsgQueue(MsgQueue **aQueue, void *aMsg, int aType) {
MsgQueue *thisQueue = malloc(sizeof(*thisQueue));
thisQueue->type = aType;
thisQueue->msg = aMsg;
thisQueue->next = NULL;
if (*aQueue == NULL) {
*aQueue = thisQueue;
} else {
while ((*aQueue)->next != NULL)
*aQueue = (*aQueue)->next;
(*aQueue)->next = thisQueue;
}
}
Here is the declaration in the messaging.h file
-------------------------------------------
int checkMessage (char *message);
void addToMsgQueue(MsgQueue **aQueue, void *aMsg, int aType);
struct order *parseOrderMsg(char *aMessageString);
and here where it is called in matchingEngine.c
---------------------------------------------
MsgQueue *aQueue;
struct fillReport *aFillReport;
if (*sellBook == NULL)
return noMatches;
while ((buyOrder.price >= (*sellBook)->order->price) && (buyOrder.actualSize > 0)){
size = buyOrder.actualSize - (*sellBook)->order->actualSize;
if (size == 0) {
aFillReport = malloc(sizeof(struct fillReport));
aFillReport->type = FILL_REPORT;
aFillReport->sellOrderID = (*sellBook)->order->ID;
aFillReport->buyOrderID = buyOrder.ID;
aFillReport->price = buyOrder.price;
aFillReport->tradedSize = buyOrder.actualSize;
addToMsgQueue(&aQueue, aFillReport, FILL_REPORT);
}
Any ideas?