Author Topic: Undefined Reference To 'stat'  (Read 2502 times)

rgzu

  • Newbie
  • *
  • Posts: 36
    • View Profile
Undefined Reference To 'stat'
« on: December 19, 2004, 02:03:59 pm »
I am trying to compile a program using the zgcc compiler and get the following error:

undefined reference to 'stat'

Here is a small test program that displays the same error:  

#include
<sys/stat.h>

main(){
 struct stat buf;
 char *fn;
 int st;
 st = stat( fn, &buf );
}


I have checked the obvious that stat.h is there and I have searched this forum and the internet and only come across a couple of references to this, but they were both in a foreign languages. Even translated they didn't seemed to make sense although it seems to be a problem with a library missing or incorrect? I am posting here to see if someone can help me out.

I am using a Zaurus 5500 with the sharp 3.13 ROM. Thanks for any help in advance.

maslovsky

  • Hero Member
  • *****
  • Posts: 1426
    • View Profile
    • http://my-zaurus.narod.ru
Undefined Reference To 'stat'
« Reply #1 on: December 20, 2004, 05:07:42 am »
You need to staticaly link with libc_nonshared.a

rgzu

  • Newbie
  • *
  • Posts: 36
    • View Profile
Undefined Reference To 'stat'
« Reply #2 on: December 20, 2004, 08:59:11 am »
Thanks for the reply. Is there somewhere that I can download this? It appears I do not have this on my device and it is needed by a program I am trying to compile.

maslovsky

  • Hero Member
  • *****
  • Posts: 1426
    • View Profile
    • http://my-zaurus.narod.ru
Undefined Reference To 'stat'
« Reply #3 on: December 20, 2004, 09:05:09 am »
Quote
Thanks for the reply. Is there somewhere that I can download this? It appears I do not have this on my device and it is needed by a program I am trying to compile.
It should be a part of gcc compiler toolchain. At least it does exist in dev-img 1.6, for exmaple...

rgzu

  • Newbie
  • *
  • Posts: 36
    • View Profile
Undefined Reference To 'stat'
« Reply #4 on: December 20, 2004, 11:42:59 pm »
I managed to extract it from dev_img-1.5 from the Zaurus Software index and place it in /home/QtPalmtop/lib where I made a symbolic link from libc.a. The program that needs it compiles fine.