Thread: math.h

  1. #1
    Registered User falconetti's Avatar
    Join Date
    Nov 2001
    Posts
    15

    Question math.h

    Hi

    I am new to c programming. I am also a linux newbie.

    Well, I am reading my first c book, "A Structured Programming Approach Using C" by Forouzan & Gilberg. So far everything has gone smooth and no real doubts have arised, at least till I started reading chapter where math functions are introduced. It seems like none of the most common math functions are included in math.h. Functions like ceil, floor, sqrt or pow are just strange to the compiler, that keeps giving me errors.

    Is there any package I could download and install in order to solve the problem?

    Thanks in advance.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Try

    Code:
    
    gcc prog.c -lm
    
    That's minus lowercase LM

  3. #3
    Registered User falconetti's Avatar
    Join Date
    Nov 2001
    Posts
    15

    Smile thanks. problem fixed

    Thank you Salem !

    Command gcc -lm prog.c solved the linking problem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. math.h
    By tsutharssan in forum C Programming
    Replies: 3
    Last Post: 07-03-2009, 02:24 PM
  2. Trig Functions without math.h
    By daltore in forum C Programming
    Replies: 13
    Last Post: 12-29-2008, 04:47 PM
  3. cosine series with out using math.h
    By indrajit_muk in forum C Programming
    Replies: 5
    Last Post: 12-16-2008, 08:17 PM
  4. undefined reference to `sqrt' when using math.h
    By Milhas in forum C Programming
    Replies: 4
    Last Post: 03-31-2008, 06:11 PM
  5. using round from math.h
    By axr0284 in forum C Programming
    Replies: 5
    Last Post: 05-02-2006, 11:23 AM