1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Rep Power

    Cool Undefined reference to `sin'

    In answer to the problem below I found that I need to use the following command
    gcc -o TestDate TestDate.c -lm
    With -lm AT THE END!!


    I compile a program with the following line
    gcc -o TestDate TestDate.c
    I am getting the following error message from gcc
    /tmp/ccIXxdWW.o: In function `MoonPhase':
    TestDate.c:(.text+0xfb6): undefined reference to `sin'
    I have included the statement #include <math.h> in the module that has the calls to the sin function but I still get the error

    I am running gcc under Xubuntu 12.10

    Please help


    Last edited by Alan.Brown; January 31st, 2013 at 01:27 AM. Reason: found solution

IMN logo majestic logo threadwatch logo seochat tools logo