[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

GCC Compiler problem



Hi folks

I have a problem with the gcc compiler which is not linking programs that use the functions in 
<math.h> standard header. I have tried to Verify the glibc and glibc-devel packages on my system.
glibc-devel is Ok but on verifying glibc package gives the following output

 rpm -V glibc
S.5....T c /etc/localtime
Which stands for (Error in S = File size, 5 means MD5 Sum, T means Mtime)
I have reinstalled the package glibc but still rpm -V glibc gives the same error.
As we can see this is a linking error, probably math.h is not present in C library properly.
I do not know if this is a bug. Users with RH 6.2 installed from June2K of PCQ please
try to run C code requiring any function from <math.h> and let me know if it works or gives 
error as in my case.


Problem:  --------------Start--------------------
 gcc -o p p.c 
/tmp/ccOk5I48.o: In function `main':
/tmp/ccOk5I48.o(.text 0x1e): undefined reference to `log'
collect2: ld returned 1 exit status
[vipin@vipin] ~$ vi p.c
[vipin@vipin] ~$ cat p.c
#include<stdio.h>
#include<math.h>

main()
{
double a, b;
a=101;
b = log(a);
return 0;

}

OUTPUT 2 ------------------------------------------------------------------
 gcc -c p.c -o p.o
[vipin@vipin] ~$ ld -o p/usr/lib/libc.a p.o -lc
ld: cannot open output file p/usr/lib/libc.a: No such file or directory
[vipin@vipin] ~$ ld -o p /usr/lib/libc.a p.o -lc
ld: warning: cannot find entry symbol _start; defaulting to 08048100
p.o: In function `main':
p.o(.text 0x1e): undefined reference to `log'


Problem ------------End--------------------------


Please help me solve the problem.


Vipin Pandey