Thread: exp() not working

  1. #1
    Registered User
    Join Date
    Aug 2010

    exp() not working


    Im kinda noob at c and c++ and this is frustrating now. I want to use simple a=exp(b) sort of thing and ive got #include <math.h> yet when I compile I get "undefined reference to 'exp' " error. what is wrong, I dont see what I am missing ?


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    This seems like a linker error, not a compiler error.

    Linker errors typically mean you need to specify a library.

    In this case, try
    gcc prog.c -lm

    That's minus-LM (in lower case)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Aug 2010
    that totally worked thanks ^-^

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Not working Right
    By raven420smoke in forum C++ Programming
    Replies: 2
    Last Post: 09-16-2005, 03:21 AM
  2. function call not working
    By swgh in forum C++ Programming
    Replies: 10
    Last Post: 06-02-2005, 12:12 PM
  3. Trying to eject D drive using code, but not working... :(
    By snowfrog in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 07:47 PM
  4. x on upper right corner not working
    By caduardo21 in forum Windows Programming
    Replies: 1
    Last Post: 02-20-2005, 08:35 PM
  5. cygwin -> unix , my code not working properly ;(
    By CyC|OpS in forum C Programming
    Replies: 4
    Last Post: 05-18-2002, 04:08 AM