Missing atan2() function
  • Order of the Butterfly
    Order of the Butterfly
    Minuous
    Posts: 161 from 2010/2/13
    I'm #including <math.h> but still getting this error message from GCC:
    undefined reference to `atan2'
    This code used to compile before I had to reformat and reinstall everything. :-( Am I missing some component?
    It compiles fine under OS3.9 (SAS/C) and Windows (Visual C), just not MOS.
    Isn't atan2() part of ANSI C (C89)?
  • »02.05.14 - 12:34
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    BSzili
    Posts: 559 from 2012/6/8
    From: Hungary
    Are you linking against libm.a? (-lm)
    This is just like television, only you can see much further.
  • »02.05.14 - 12:40
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    pegasos-sigi2
    Posts: 265 from 2006/8/31
    You must define your own function. Atan2 did't exists in ANSI C of MorphOS
    Spreedy - The spreedsheet editor of MorphOS
    Calimero - Do you know about the new DTP Program for MorphOS ?
  • »02.05.14 - 14:51
    Profile
  • MorphOS Developer
    bigfoot
    Posts: 508 from 2003/4/11
    Quote:

    pegasos-sigi2 wrote:
    You must define your own function. Atan2 did't exists in ANSI C of MorphOS


    Sorry, this is not true. MorphOS' libm does have the atan2() function. BSzili's answer is likely the correct one.
    I rarely log in to MorphZone which means that I often miss private messages sent on here. If you wish to contact me, please email me at [username]@asgaard.morphos-team.net, where [username] is my username here on MorphZone.
  • »02.05.14 - 18:11
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Minuous
    Posts: 161 from 2010/2/13
    Yes, -lm fixes the issue. Many thanks to you all.
  • »03.05.14 - 01:16
    Profile Visit Website