I have encountered a problem when calling my freeHeap function inside of sortComp.c
I am calling it as such
heapRef myHeap = buildHeap(numData, heapSort, numData);
freeHeap(myHeap);
When compiling I recieve the error "Undefined reference to 'freeHeap'"
I am including heap.h and inside of heap.h i have declared freeHeap
void freeHeap(heapRef *);
I am compiling it as such
gcc -o sortComp sortComp.c insertionSort.c heap.c insertionSort.h heap.h
It is defined in heap.c as
void freeHeap(heapRef *pH){
heapRef H = *pH;
free(H->data);
free(H);
}
FIXED:
I changed the calling of freeHeap(myHeap);
to
freeHeap(&myHeap);
and it stopped complaining