I posted this to gnu.gcc.help, but it seems worth asking on this list as well. Particularly since it was strongly suggested by participants that I read this book. This is on SuSE 9.3. --------------- Forwarded message (begin) Subject: "Formal" solution: parser.y:7: error: `stderr' undeclared (first use in this function) From: Hattuari <susudata@setidava.kushan.aa> Date: Sat, 27 Aug 2005 00:16:10 -0400 Newsgroup: gnu.gcc.help I'm going through the Goat Book http://sources.redhat.com/autobook/, and when I followed the instructions on how to build the first example, I received the following message: Fri Aug 26 23:47:43:> make if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\" -DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT parser.o -MD -MP -MF ".deps/parser.Tpo" -c -o parser.o parser.c; \ then mv -f ".deps/parser.Tpo" ".deps/parser.Po"; else rm -f ".deps/parser.Tpo"; exit 1; fi parser.y: In function `yyerror': parser.y:7: error: `stderr' undeclared (first use in this function) parser.y:7: error: (Each undeclared identifier is reported only once parser.y:7: error: for each function it appears in.) make: *** [parser.o] Error 1 I may (probably can) get this to compile by some trial and error. But that's why I'm reading the Goat Book! I've been using the other method for years, and I decided to start doing things right. Starting from scratch in §5.2 this is exactly what I did, and what was output: $ aclocal $ automake --add-missing configure.in: installing `./install-sh' configure.in: installing `./missing' Makefile.am: installing `./INSTALL' Makefile.am: required file `./NEWS' not found Makefile.am: required file `./README' not found Makefile.am: required file `./AUTHORS' not found Makefile.am: required file `./ChangeLog' not found Makefile.am: installing `./COPYING' Makefile.am: installing `./depcomp' # Hey, they told me to do it that way! $ touch NEWS README AUTHORS ChangeLog $ automake --add-missing $ ls AUTHORS Makefile.in configure main.c COPYING NEWS configure.in missing ChangeLog README depcomp nly.c INSTALL aclocal.m4 foo.c parser.y Makefile.am autom4te.cache install-sh scanner.l $ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking for flex... flex checking for yywrap in -lfl... yes checking lex output file root... lex.yy checking whether yytext is a pointer... yes checking for bison... bison -y configure: creating ./config.status config.status: creating Makefile config.status: executing depfiles commands $ make all if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\" -DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT main.o -MD -MP -MF ".deps/main.Tpo" -c -o main.o main.c; \ then mv -f ".deps/main.Tpo" ".deps/main.Po"; else rm -f ".deps/main.Tpo"; exit 1; fi if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\" -DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT foo.o -MD -MP -MF ".deps/foo.Tpo" -c -o foo.o foo.c; \ then mv -f ".deps/foo.Tpo" ".deps/foo.Po"; else rm -f ".deps/foo.Tpo"; exit 1; fi if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\" -DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT nly.o -MD -MP -MF ".deps/nly.Tpo" -c -o nly.o nly.c; \ then mv -f ".deps/nly.Tpo" ".deps/nly.Po"; else rm -f ".deps/nly.Tpo"; exit 1; fi flex scanner.l sed '/^#/ s|lex.yy\.c|scanner.c|' lex.yy.c >scanner.c rm -f lex.yy.c if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\" -DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT scanner.o -MD -MP -MF ".deps/scanner.Tpo" -c -o scanner.o scanner.c; \ then mv -f ".deps/scanner.Tpo" ".deps/scanner.Po"; else rm -f ".deps/scanner.Tpo"; exit 1; fi bison -y parser.y if test -f y.tab.h; then \ to=`echo "parser_H" | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ sed -e "/^#/!b" -e "s/Y_TAB_H/$to/g" -e "s|y\.tab\.h|parser.h|" \ y.tab.h >parser.ht; \ rm -f y.tab.h; \ if cmp -s parser.ht parser.h; then \ rm -f parser.ht ;\ else \ mv parser.ht parser.h; \ fi; \ fi if test -f y.output; then \ mv y.output parser.output; \ fi sed '/^#/ s|y\.tab\.c|parser.c|' y.tab.c >parser.ct && mv parser.ct parser.c rm -f y.tab.c if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"foonly\" -DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. -g -O2 -MT parser.o -MD -MP -MF ".deps/parser.Tpo" -c -o parser.o parser.c; \ then mv -f ".deps/parser.Tpo" ".deps/parser.Po"; else rm -f ".deps/parser.Tpo"; exit 1; fi parser.y: In function `yyerror': parser.y:7: error: `stderr' undeclared (first use in this function) parser.y:7: error: (Each undeclared identifier is reported only once parser.y:7: error: for each function it appears in.) make: *** [parser.o] Error 1 I have not tried to fix this yet. The reason I'm asking is not that I want the program to compile. I don't even know what it does. I want to know the _right_ way to solve these kinds of problems. Any suggestions? -- STH --------------- Forwarded message (end) -- Regards, Steven