Q:

undefined reference to `pow' - makefile

I have a problem building a program using a makefile.
Upon running make I'm getting an error:
ScanData.o: In function `CheckGrade':
ScanData.c:(.text+0x1ef): undefined reference to `pow'

This is the makefile:
a.out: Update.o ScanData.o ReallocAndFree.o PrintStudentMaxGrade.o PrintAllStudents.o DeleteStudent.o AddStudent.o AddOrUpdate.o main.o
 gcc Update.o ScanData.o ReallocAndFree.o PrintStudentMaxGrade.o PrintAllStudents.o DeleteStudent.o AddStudent.o AddOrUpdate.c main.o

AddOrUpdate.o: AddOrUpdate.c AddOrUpdate.h
    gcc -c AddOrUpdate.c

AddStudent.o: AddStudent.c AddStudent.h
    gcc -c AddStudent.c

DeleteStudent.o: DeleteStudent.c DeleteStudent.h
    gcc -c DeleteStudent.c

PrintAllStudents.o: PrintAllStudents.c PrintAllStudents.h
    gcc -c PrintAllStudents.c

PrintStudentMaxGrade.o: PrintStudentMaxGrade.c PrintStudentMaxGrade.h
    gcc -c PrintStudentMaxGrade.c

ReallocAndFree.o: ReallocAndFree.c ReallocAndFree.h
    gcc -c ReallocAndFree.c

ScanData.o: ScanData.c ScanData.h
    gcc -c ScanData.c -lm

Update.o: Update.c Update.h
    gcc -c Update.c

main.o: main.c AddOrUpdate.c AddStudent.c DeleteStudent.c PrintAllStudents.c PrintStudentMaxGrade.c ReallocAndFree.c ScanData.c Update.c
    gcc -c main.c

Thank you.

A:

pow is a stdlib function, but to use it you should link the stdlib itself (math lib).
Usually gcc does it automatically, but try adding -lm link flag:
gcc -lm Update.o ScanData.o <..the rest of object files..>

Also make sure that libc is present in system (on debian/ubuntu - dpkg -s libc6-dev should tell that it is installed)
Not directly related to question:
does main.o really depend on all the sources? it only builds from main.c

