Hi,
I have a problem referencing a function in another file. I get the below error and wonder if anyone has any ideas:
Code:MYprog.c: In function `main': MYprog.c:33: warning: implicit declaration of function `MYFW_SendInform' MYprog.c:33: error: called object is not a function
I have the following files The intention is that MYFW becomes a libray accessible to a number of developments...
MYFW.h/MYFW.c: A collection of constants and functions that provide common processing tasks
MYprog.h, MYprog.c: The collection of functions to perform the specific tasks in hand.
Code:#MYFW.h # A header file for the FRAMEWORK. #ifndef _MYFW_H #define _MYFW_H #define MYFWinform \ (void)MYFW_SendInform(__FILE__, __LINE__, "INFORM") #endifCode:MYFW.c # the source code for the FRAMEWORK. #include <MYFW.h> PUBLIC void MYFW_SendInform (IN char *pcSourceFile, IN int iSourceLine, IN char *pcMessType) { // I know I'n not using the params, want to get it working first. printf("MYFW_SendInform: in\n"); }
Code:#MYprog.h # A header file for the DEVELOPMENT. #ifndef MYPROG_H #define MYPROG_H #include <MYFW.h> #endifSo the MyProg.c includes MYprog.hCode:#MYprog.c # The source for the the DEVELOPMENT. #include "MYprog.h" int main(int argc, char **argv) { MYFWinform("main: in"); exit(0); }
MYFW.c includes MYFW.h
and MYProg.h includes MYFW.h.
Is there something wrong with the syntax, the way I've linked the files or is this a problem with the makefile? Should I be compiling the MYFW as an object first? Here is my makefile.....
Code:# makefile OBJDIR=../OBJ BINDIR=../../bin CC=gcc CFLAGS=-I. -g -Wall EXE=MYProg INC=MYFW.h MYProg.h SRC=MYFW.c MYProg.c ${OBJDIR}/%.o: %.c ${INC} ${CC} -c -o $@ $< ${CFLAGS} MYProg: ${OBJ} ${CC} -o ${BINDIR}/${EXE} ${OBJ} ${CFLAGS}



LinkBack URL
About LinkBacks



