I created my own header file in C by creating the ff. files: myfile.h, myfile.c and main.c.Afterwards, I compiled myfile.c so I already have the object file for it, but the problem is when I compiled and run main.c this error message appeared: "Undefined symbol _sum". Please help me to fix this error.See the complete source code of mine below.
// library header file: myfile.h
#ifndef MY_FILE
#define MY_FILE
int sum(int x, int y);
#endif
// library implementation file: myfile.c
#include "myfile.h"
int sum(int x, int y)
{
return x+y;
}
// Program to be run: main.c
#include<stdio.h>
#include "myfile.h"
main()
{
clrscr();
printf("The sum of 3 and 5 is %i",sum(3,5));
getch();
}