eao@point.mps.ohio-state.edu (Ed Overman) (10/27/90)
I just pulled gcc over from atari.archive (in particular gccbin and g++-gnulib) and got it up and running on my Mega-2 running gulam. However I must be doing something wrong. The trivial K&R program hello.c (i.e., printf("hello, world\n")) works fine but if I add the line fprintf(stdout, "hello, world\n") it aborts when loading with: hello.o: Undefined symbol _stdout referenced from text Something very funny is going on because printf calls _printf_guts with fputc(c,stdout) being one of its arguments - and this works fine. I tried recompiling fprintf and replacing it in gnu.olb . This leads to another problem because if I do ar rv gnu.olb fprintf.o then it creates the new library gnu.ol$ (presumably to mv to gnu.olb when it is done) and aborts when it closes this file. I then added a printf statement in the file fprintf.c, recompiled it, and added it to gnu.olb using ar rv (so I had to exit gulam to rename gnu.ol$ to gnu.olb). Then when I tried compiling hello.c I had lots of error messages since ld didn't know what to do with _printf . Somehow when I am compiling the include files are not being handled correctly. However the #include command is working because when I comment it out I get a compilation error that stdout is undefined (so I think my GNULIB and GNUINC are correct). Please - what am I doing wrong? Thanks, Ed Overman
7103_2622@uwovax.uwo.ca (Eric Smith) (10/29/90)
In article <1990Oct27.163922.3208@zaphod.mps.ohio-state.edu>, eao@point.mps.ohio-state.edu (Ed Overman) writes: > I just pulled gcc over from atari.archive (in particular gccbin and > g++-gnulib) and got it up and running on my Mega-2 running gulam. However > I must be doing something wrong. The trivial K&R program hello.c > (i.e., printf("hello, world\n")) works fine but if I add the line > fprintf(stdout, "hello, world\n") it aborts when loading with: > hello.o: Undefined symbol _stdout referenced from text > Something very funny is going on because printf calls > _printf_guts with fputc(c,stdout) being one of its arguments - and this > works fine. Sounds like you've got a library/include file mismatch. There are two "families" of libraries for the gcc: the original library by John Dunning, that came with gcc 1.23, and derivatives (including, I think, the one that comes with g++); and the gcc 1.37 library that Jwahar Bammi and I put together, and derivatives (including one by Edgar Roeder, and the MiNT library). The former has _printf_guts and stdout; the latter has _doprnt and _iob[]. My suspicion is that you're using header files for the first library with a gnu.olb that's set up for the second library. -- Eric R. Smith email: Dept. of Mathematics ersmith@uwovax.uwo.ca University of Western Ontario ersmith@uwovax.bitnet London, Ont. Canada N6A 5B7 ph: (519) 661-3638
apratt@atari.UUCP (Allan Pratt) (10/30/90)
eao@point.mps.ohio-state.edu (Ed Overman) writes: >fprintf(stdout, "hello, world\n") it aborts when loading with: > hello.o: Undefined symbol _stdout referenced from text You are missing the line #include <stdio.h> -- this header file is required when using the standard IO functions and it defines symbols like stdout. Technically, it's even required when you use printf, but your program happens to compile because GCC happens to do the right thing without the printf declaration. This is not an accident: GCC was designed in part to be forgiving to C programmers who don't do things they technically should do. I have used an ANSI compiler which did NOT forgive using printf without including stdio.h! ============================================ Opinions expressed above do not necessarily -- Allan Pratt, Atari Corp. reflect those of Atari Corp. or anyone else. ...ames!atari!apratt