-
include Problem
I have the following problem that i have never seen before.
I have the following program queue_c.c,
Code:
#include "JMS/C_API/stlport/stdlib.h"
#include "JMS/C_API/stlport/stdio.h"
#include "JMS/C_API/stlport/string.h"
void main(int argc, char *argv[]) {
receiver();
}
void receiver(){
ConnectionSetClientID(pQueueConnection, (char*)"RECEIVER", &iErr, szErrBuf);
}
And the mscapi.h has struct and function definitions,
STC_JMS_CAPI void ConnectionSetClientID(SBYN_Connection *, char *, int *, char *);
When i compile I get the following error
Undefined first referenced
symbol in file
ConnectionSetClientID queue_c.o
QueueReceiverClose queue_c.o
I thought maybe the include wasn't working properly, so i put the function definitions in the c but i got the same errors. I have never seen this before and find this quite wierd.
Any help would be good.
-
You need to link the .c file where those functions actually reside in with your program's .c file to make the final executable. Function prototypes alone aren't enough to actually perform the function.
-
header files contain the declarations
source files contain the definitions