Thread: undefined reference to sqrt

  1. #1
    Registered User
    Join Date
    May 2009

    Angry undefined reference to sqrt


    I am using Fedora 7 with eclipe and I have the same problem with the sqrt

    do anyone know how to includ the -lm in the make file ?

    yeah , one more thing when I want to compile my code I just do make in the console and it generates for me the file ( but it gives me along with it this error)

    Undefined reference to sqrt

    << split from dead thread - undefined reference to 'sqrt' >>

  2. #2
    Registered User
    Join Date
    Nov 2004
    Add "-lm" to the line in the makefile where you are compiling the source file. If you have something like
    gcc foo.c -o foo
    then make it
    gcc foo.c -o foo -lm
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM