Loading ...
Sorry, an error occurred while loading the content.

[nslu2-linux] how to include a C library with gcc on NSLU2

Expand Messages
  • duy_pham
    Hi, I have some problem managing C library in NSLU2 . I use Unslung and have optware-devel installed (it include gcc and glibc) but I can t include some
    Message 1 of 1 , Nov 26, 2007
    • 0 Attachment
      Hi, I have some problem managing C library in NSLU2 . I use Unslung and have
      optware-devel installed (it include gcc and glibc) but I can't include some
      libraries such as math.h or stdio.h. Here my test code:

      #include <math.h>
      #include <stdio.h>

      int
      main (void)
      {
      double x = sqrt (2.0);
      printf ("The square root of 2.0 is %f\n", x);
      return 0;
      }

      and when I compile it : "gcc test.c -o test.exe" it said:
      "stdio.h: No such file or directory"
      "math.h : No such file or directory"
      "undefined reference to `sqrt' "

      When I try with another simple program using some simple function such as
      printf or scanf, and delete the line #include <stdio.h> and
      #include<math.h>, it work. So that means stdio's function work well but
      math's function does not work properly.

      Please teach me how to include library in my program, do I need to export
      any PATH or enviroment. Thank you very much.
      --
      View this message in context: http://www.nabble.com/how-to-include-a-C-library-with-gcc-on-NSLU2-tf4874846.html#a13948638
      Sent from the Nslu2 - Linux mailing list archive at Nabble.com.
    Your message has been successfully submitted and would be delivered to recipients shortly.