This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with header files.


Dear GCC Gurus, 
I have a problem getting GCC to refer to header files.
For example the following program....
------------Code Begins Here------------
#include <stdio.h>
#include <math.h>


main() {
    float uno;
    float  duo;
    uno=7.778;
    duo=sqrt(uno);
    printf("sqrt of %f is %f \n", uno, duo);
}

------------Code Ends Here--------------
Produces the following message at compile time...

[fakeuser@fakehost BeginC]$ gcc trial.c
/tmp/ccBm2UFL.o: In function `main':
/tmp/ccBm2UFL.o(.text+0x1b): undefined reference to `sqrt'
collect2: ld returned 1 exit status */

__________________________________________

What is going on?  I would really appreciate your advice on this
one.  I have to admit to being a newbie to C programing.
I have installed glibc 2.2.12 (full install), and gcc 2.9.6-85, and 
am using RedHat 7.0 distro.  The original versions of glibc gave the 
same errors.

Looking forward to your advice...otherwise I will end up doin my
iminent assignments on DOS....a fate worse than death.

Matt Redding


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]