Link to home
Start Free TrialLog in
Avatar of asaeed
asaeed

asked on

storage size of `fstat'isn't known

hi,
i have a program that used to run on IBM AIX server now i want to change it to Linux. but am getting some problems. First when i complied it was giving
multiple defination of fstat ()  first defined in /usr/include/sys/stat.h
then i put
#ifndef _SYS_STAT_H
#define _SYS_STAT_H 1
#include <sys/stat.h>
#endif
to eliminate the error but now the error is coming for the variables defined and its structure's enum values. like
storage size of `fstat'isn't known
(defined as->       struct stat fstat1;)
`S_IRWXU' undeclared (first use in this function)
storage size of `err_stat' isn't known
the sys/stat is included, size should be there, what am i doing wrong?
i cant find any help regarding this on the net.
thanks
Avatar of F. Dominicus
F. Dominicus
Flag of Germany image

Do you have all includes? It does not look like it:
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>

maybe you'll need stdlib also, but first check the manual pages
man fstat
and see what you can find about includes

Regards
Friedrich
Avatar of asaeed
asaeed

ASKER

i do have the all these includes in many header files. and .c files.
now i have done this
#ifndef _SYS_STAT_H
#define _SYS_STAT_H 1
#include <sys/stat.h>
#endif
for all the files where sys/stat.h is used but now i am still getting the following errors but in different places than before.
 `S_IRWXU' undeclared (first use in this function)
 (Each undeclared identifier is reported only once
 for each function it appears in.)
 `S_IRWXG' undeclared (first use in this function)
 `S_IRWXO' undeclared (first use in this function)
Avatar of asaeed

ASKER

i think this is another error. `S_IRWXU' undeclared (first use in this function)
 not related to the current problem, so do u think that by putting
#ifndef _SYS_STAT_H
#define _SYS_STAT_H 1
#include <sys/stat.h>
#endif
problem is solved????
Avatar of asaeed

ASKER

now the mkdir() function has the `S_IRWXU' undeclared (first use in this function)
problem. but i am still getting the storage size of `fstat'isn't known
problem in other modules i am trying to make.
ASKER CERTIFIED SOLUTION
Avatar of js-profi
js-profi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of asaeed

ASKER

#include <sys/stat.h>
 was already used. i added the ifndef.... my self.  
but its not working. also the
`S_IRWXG' etc.
are defined in sys/stat.h but i dont know why its not workig.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
why did you add the macros? it compiles only  some ns faster with them but could give severe problems. then you post 'struct stat fstat1' and error 'fstat' unknown. fstat and fstat1 is pretty different.
what do you need the S_IRWXU and err_stat for? those names can be different with different platforms. i never used them.
You need them on Unices for handling the file system. And those names can be found in POSIX so it's standard on any Unix.
Avatar of asaeed

ASKER

the header files are available in /usr/include.
i removed the ifndef now the object files are created but at the end i get these errors.
/folder1/convert.o(.text+0x0): In function `fstat':
/usr/include/sys/stat.h:371: multiple definition of `fstat'
./folder1/processin.o(.text+0x0):/usr/include/sys/stat.h:371: first defined here
./folder1/rcon.o(.text+0x0): In function `fstat':
/usr/include/sys/stat.h:371: multiple definition of `fstat'
./folder1/processin.o(.text+0x0):/usr/include/sys/stat.h:371: first defined here
./folder1/readinfo.o(.text+0x0): In function `fstat':
/usr/include/sys/stat.h:371: multiple definition of `fstat'
./folder1/processin.o(.text+0x0):/usr/include/sys/stat.h:371: first defined here
./folder1/dbf.o(.text+0x0): In function `fstat':

the fstat,mkdir function are as follows

mkdir(TmpIndirName,(S_IRWXU | S_IRWXG | S_IRWXO) );
struct stat fstat1;
      stat(outFile, &fstat1);      
struct stat             statbuf;
Avatar of asaeed

ASKER

compilation syntax is like as follows
cc -g -DMETERSTD -D__IBM__  -DORACLE_DB -D__ENGLISH__ -D__PERFORMANCE__ -D__DBV__ -DPING_BY_SH   -DPOSIX -DMSG -o  fooexe ./folder1/processin.o ./folder1/abc.o ./folder1/f1.o ./folder1/escon.o ./folder1/f1v.o ./folder1/meon.o ./folder1/readinfo.o ./folder1/zw.o ./folder1/dbf.o ./folder1/timewr.o ./folder1/tim.o ./folder1/byder.o ./folder1/reu.o ./folder1/filler.o ./folder1/acquire.o ./folder1/db.o ./folder1/fieq.o ./folder1/qdb.o ./db.o -I/u01/app/oracle/product/9.2.0//precomp/public -lm -I./include -I/u01/app/oracle/product/9.2.0//precomp/public  -I/oracle_install/c.ora -L/oracle_install/c.ora  -L. -L/usr/lib /oracle_install/ctlib.ora/ctlib.o -L/u01/app/oracle/product/9.2.0//lib -lclntsh -lpthread  -L/usr/lib/  -lrt
Avatar of asaeed

ASKER

thanks i removed the ifndef things and then it was giving the multiple declaration problem. previously i removed __inline__ from the stat.h for fstat (it was giving some problem at that time.) but when i put that back it started to compile. thanks.
Where's the code you want to compile? Have you stripped it down? What do you think your code tells us?
What the meaning of TmpIndirName, we did not have the slightes clue. You do not even bother to post your include lines, Nothing but error message and "guessworking" this will not work.