kirchner@umn-cs.cs.umn.edu (Roger B. Kirchner) (04/27/91)
Several people responded to my query about including stdio.h in a C++ program. The trick is to use extern: extern "C" { #include <stdio.h> } And the following post from Mark Adler on installing the gnu C++ libary works as advertised: ------------------------------------------- From: madler@nntp-server.caltech.edu (Mark Adler) Subject: Re: where are libg++ sources? I tried, but.... Message-ID: <1991Apr13.080013.5302@nntp-server.caltech.edu> Date: 13 Apr 91 08:00:13 GMT References: <TY.91Apr13010352@reef.cis.ufl.edu> Organization: California Institute of Technology, Pasadena Lines: 47 Tyng-Jing Yang requests: >> Is there anyone like to submit their patch files or working libg++ And ruin all your fun?! Well, if you insist ... How I installed the Gnu C++ library (your mileage may vary): 1. Got libg++-1.39.0.tar.Z from prep.ai.mit.edu via anonymous ftp. 2. In /me/tmp, I did: "zcat libg++-1.39.0.tar.Z | tar xvf -". Did a "cd libg++-1.39.0". 3. Created /usr/gnu, and /usr/gnu/lib (writable from me). 4. Changed Makefile(32) to "PWD=/me/tmp/libg++-1.39.0", commented out Makefile(31) (inserted "#" in first column). 5. Uncommented Makefile(93) to leave out the gnu malloc routines. 6. Changed "GXX = g++" to "GXX = cc++" in Makefile(120). 7. Changed "CC = gcc" to "CC = cc" in Makefile(124). 8. Commented out Makefile(148) to kill verbosity flags. 9. Did "make src" (takes a while--ignore the warnings). 10. Did "make install-lib" (puts libg++.a in /usr/gnu/lib). 11. Added these lines after line 2 in g++-include/time.h: #ifdef NeXT #define _TIME_H 1 #endif 12. Did "make install-include-files" (this puts the include files in /usr/gnu/lib/g++-include). 13. Did "make tests" (this takes rather a lot of disk space). There were differences from the expected output, but they appeared to just be precision problems. I didn't investigate further. 14. Removed the directory in tmp ("cd .. ; rm -rf libg++-1.39.0"). 15. Made a test program, x.cc, containing: #include <stream.h> main() { cout << "Hello world!\n"; } and compiled it using: cc++ -I/usr/gnu/lib/g++-include -O x.cc -L/usr/gnu/lib -lg++ and then: a.out printed: Hello world! How about that. And then you can merrily cc++ to your heart's content. Have fun. Mark Adler madler@pooh.caltech.edu ------------------------