help regarding linking
rganti@nd.edu
rganti@nd.edu
Sat Nov 27 05:14:00 GMT 2004
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
More information about the Gcc-help
mailing list