When putting your code in different source files, you should create header files that contain the declarations of functions and variables that you want to have access to in other modules. So, in this case, you would create a header file named, perhaps, file2.h that contains the prototype of your to_print function defined in file2.c: #ifndef FILE2_H #define FILE2_H void to_print(float a, float b); #endif Then you would include file2.h in file1.c: #include "file2.h" Note the #ifdef, etc., around your declaration. Put all the guts of your header file between those preprocessor directives. That effectively keeps the header file from being processed more than once if it happens to get included more than once (which happens easily and perhaps frequently in large projects). Thanks, Lyle -----Original Message----- From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On Behalf Of rganti@xxxxxx Sent: Friday, November 26, 2004 10:14 PM To: gcc-help@xxxxxxxxxxx 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