exp() not working

This is a discussion on exp() not working within the C Programming forums, part of the General Programming Boards category; Hi Im kinda noob at c and c++ and this is frustrating now. I want to use simple a=exp(b) sort ...

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    2

    exp() not working

    Hi

    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 ?

    thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,851
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    2
    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, 04:21 AM
  2. function call not working
    By swgh in forum C++ Programming
    Replies: 10
    Last Post: 06-02-2005, 01: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, 08: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, 05:08 AM

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