That surely isn't your function.o file. Please tell me that's not your function.o file. If that is, rename it to function.c and stop lying to your C compiler.
If i try to make an executable with the main. and function.c files instead of main.c and function.o the result is the same.