Beginner Question

This is a discussion on Beginner Question within the C Programming forums, part of the General Programming Boards category; After including the math.h library my compiler returns the error: "undefined symbol sqrt. ld fatal: symbol referencing errors." when trying ...

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    2

    Beginner Question

    After including the math.h library my compiler returns the error: "undefined symbol sqrt. ld fatal: symbol referencing errors." when trying to use the square root function. Any ideas what to do? Thanks in advance.

    TKnight

  2. #2
    Registered User
    Join Date
    Nov 2008
    Posts
    2
    Turns out the compiler was limited and using a different one solved the problem.

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Link with the math library, usually "-lm"

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,766
    Quote Originally Posted by TKnight View Post
    Turns out the compiler was limited and using a different one solved the problem.
    Now THAT is why the math library should always be included
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner: Linked List question
    By WeatherMan in forum C++ Programming
    Replies: 2
    Last Post: 04-03-2008, 07:16 AM
  2. Quick IF statement question (beginner)
    By jim.rattlehead in forum C Programming
    Replies: 23
    Last Post: 11-29-2007, 05:51 AM
  3. beginner question
    By Barrot in forum C++ Programming
    Replies: 4
    Last Post: 08-19-2005, 02:17 PM
  4. Question About External Files (Beginner)
    By jamez05 in forum C Programming
    Replies: 0
    Last Post: 08-11-2005, 07:05 AM
  5. Beginner on Win32 apps, lame question.
    By Templario in forum C Programming
    Replies: 3
    Last Post: 11-06-2002, 07:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21