Hello Radha Krishna Ganti, I beleive by including a prototype for the function to_print in file1.c should solve your problem. Best Regards, Selva. ----- Original Message ----- From: <rganti@xxxxxx> To: <gcc-help@xxxxxxxxxxx> Sent: Saturday, November 27, 2004 10:44 AM Subject: help regarding linking > > Hi, > I am a newbie at using gcc. I wanted to write functions and the main file > in different files > > I am using the following to compile > gcc -c file1.c > gcc -c file2.c > gcc file1.o file2.o > a.out > 2.00000 1.90000 > > I am not able to understand why that is the output. But if write the > function to_print in file1.c and compile, it works normally. > If I replace all floats in both files by double it works > > What is happening? Am I compiling them wrong. > > > /*----------- file1.c-------------*/ > #include<stdio.h> > #include<stdlib.h> > > int main() > { > float a,b; > a=1.2; > b=1.3; > to_print(a,b); > return 0; > } > ---------------file2.c------------- > #include<stdio.h> > void to_print(float a, float b) > { > printf("%f , %f \n", a,b); > > } > > > > -regards > Radha Krishna Ganti > > -- > Radha Krishna Ganti > EE-Grad Student > Univ. Of Notre Dame > >