×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    32

    hypot()/hypotf() in libc

    Are they only a function prototype? When I try to build this code I got error : In function `main': hellomath.c.text+0xa): undefined reference to `hypot'
    My code :
    int main ()
    {
    double a = 4, b = 3, n;
    n = hypot(a,b);
    printf("hypot is : %d", n);
    a=45;
    n=cos(a); // compilation success!
    printf("cos is : %d", n);
    return 0;
    }

  2. #2
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: hypot()/hypotf() in libc

    Hello,
    they seem to be there since 3rd:
    http://docs.huihoo.com/symbian/s60-3...tml/hypot.html

    br,
    pg

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    32

    Re: hypot()/hypotf() in libc

    I know about open C/C+ but I ask different.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: hypot()/hypotf() in libc

    undefined reference error usually comes from missing library, so have you added the libm.lib into your mmp file already.

  5. #5
    Registered User
    Join Date
    Jul 2007
    Posts
    32

    Re: hypot()/hypotf() in libc

    How use function in #ifndef _REENT_ONLY directives? This may hide function from compiler.

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: hypot()/hypotf() in libc

    its not function, its directive, and its indeed used for hiding stuff, and I would suppose if you have codes inside the parts where this is used. So you should see that the _REENT_ONLY is defined, and why it is defined, and whether you could comment out the place where it is defined.

    Here's one link which discussed on usage of the directive you are using : http://msdn.microsoft.com/en-us/library/2a1b21sf.aspx

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,734

    Re: hypot()/hypotf() in libc

    Two things:
    1) _REENT_ONLY is not Symbian-related stuff, so you can refer to anything what Google finds for you in the topic. The role of this condition is when you have thread-safety concerns, defining this symbol will remove non-thread safe functions in certain headers. You would use it when compiling Linux kernel for example, but it is probably not present when you are building random Symbian stuff
    2) #somethings happen in pre-processor time, while your undefined error comes in linker time, 2 steps later. So the compiler (residing between pre-processor and linker) either saw the functions (remember, it was #ifndef), or you just simply do not need them. The .lib file has no conditional features, it always contains a function, or always misses it.

Similar Threads

  1. how to get libc.dso?
    By gougou0601 in forum Symbian
    Replies: 2
    Last Post: 2011-01-22, 11:18
  2. Using libc
    By symbi4n_programmer in forum Symbian
    Replies: 5
    Last Post: 2009-07-31, 09:25
  3. Replies: 3
    Last Post: 2009-06-16, 15:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×