This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
help regarding linking
- From: rganti at nd dot edu
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 27 Nov 2004 00:14:27 -0500
- 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