* #include or redeclaration problems
@ 1993-11-21 13:51 Douglas Jones
0 siblings, 0 replies; only message in thread
From: Douglas Jones @ 1993-11-21 13:51 UTC (permalink / raw)
I have two programs I was trying to get to run on the alpha. Both of these
programs are an example of a problem I have been having with a lot of programs.
Here is the output of makes for both programs:
For the program zoo (arhcive program)
Here is the make script (I copied mkbsd to mkosf and made the mods):
# @(#) mkbsd 2.2 88/08/15 15:41:34
#4.3BSD -- make Zoo and Fiz
#make "cswitch=-c -O -DBSD4_3 -DALWAYS_INT" "ldswitch=-o zoo" zoo
#make "cswitch=-c -O -DBSD4_3 -DALWAYS_INT" "ldswitch=-o fiz" fiz
make "cswitch=-c -O -DBSD4_3" "ldswitch=-o zoo" zoo
make "cswitch=-c -O -DBSD4_3" "ldswitch=-o fiz" fiz
If i defined "-DALWAYS_INT", it works ok; but the definittion of fread and
fwrite are size_t (long), not int (accordning to the man page).
%mkosf
cc -c -O -DBSD4_3 -DBIG_MEM -DNDEBUG addbfcrc.c
cc -c -O -DBSD4_3 -DBIG_MEM -DNDEBUG addfname.c
/usr/lib/cmplrs/cc/cfe: Error: ./various.h, line 62: redeclaration of 'fread'; previous declaration at line 154 in file '/usr/include/stdio.h'
size_t fread ();
-------^
/usr/lib/cmplrs/cc/cfe: Error: ./various.h, line 62: Incompatible function return type for this function
size_t fread ();
-------------^
/usr/lib/cmplrs/cc/cfe: Error: ./various.h, line 63: redeclaration of 'fwrite'; previous declaration at line 155 in file '/usr/include/stdio.h'
size_t fwrite ();
-------^
/usr/lib/cmplrs/cc/cfe: Error: ./various.h, line 63: Incompatible function return type for this function
size_t fwrite ();
--------------^
*** Exit 1
Stop.
Ok, I know I can fix it with the "-DALWAYS_INT", but look at the stdio.h file
and you will see both type of definitions, int and size_t for fread and fwrite
routines. I have tried -std, -std0, and -std1. They don't seem to work for
this stituation. When I use them, these errors might be fixed, but others
(like "declaration func(arg1, arg2, ...)") cause errors.
Now the second case: the zip program: I some changes in some files to
fix a dirent vs direct problem. I tried it with -D_BSD as well as without
-D_BSD. I get the same error on "perror". Here is the output:
%make osf
make zips CFLAGS="-O -DDIRENT -D_BSD"
cc -O -DDIRENT -D_BSD -DEXPORT -c zip.c
uopt: Warning: main: this procedure not optimized because it
exceeds size threshold; to optimize this procedure, use -Olimit option
with value >= 588.
cc -O -DDIRENT -D_BSD -DEXPORT -c zipfile.c
cc -O -DDIRENT -D_BSD -DEXPORT -c zipup.c
cc -O -DDIRENT -D_BSD -DEXPORT -c fileio.c
/usr/lib/cmplrs/cc/cfe: Error: /usr/include/errno.h, line 278: redeclaration of 'perror'; previous declaration at line 216 in file '/usr/include/stdio.h'
extern int perror();
-----------^
/usr/lib/cmplrs/cc/cfe: Error: /usr/include/errno.h, line 278: Incompatible function return type for this function
extern int perror();
-----------------^
*** Exit 1
Stop.
*** Exit 1
Stop.
The -Olimit is no prob, just change from the default limit of 500. What is
starting to be a problem, is the errors with perror. There is no declaration
of perror in any of the *.h or *.c files. As a matter of fact, perror is not
even called in fileio.c.
I can get the first case (zoo) to work by defining "-DALWAYS_INT", but I
would like it to agree with the return of fread/fwrite. The second one,
I'm not sure what to do.
Any help would be greatly appreciated,
Thanks,
Douglas
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1993-11-21 13:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-11-21 13:51 #include or redeclaration problems Douglas Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox