🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #5959

fix-header bug in gcc-2.7.2.1

#5959
From: Le Duc T.
Date: Tue, 14 Jan 1997 00:00
61 lines
2639 bytes
Hi,

I just spent 2 months tracking a problem with the header files.
My system is sparc-sun-sunos4.1.3_U1

From the original gcc-2.7.2.1, I did the following:

configure --prefix=/tmp_mnt/users/gen1/le/sun/gnu --local-prefix=/tmp_mnt/users/gen1/le/sun/gnu --gxx-include-dir=/tmp_mnt/users/gen1/le/sun/gnu/g++-include --host=sparc-sun-sunos4.1.3_U1 --with-gnu-ld
make LANGUAGES=c
make stage1
make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2" LANGUAGES="c c++ objective-c proto"
make stage2
make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2" LANGUAGES="c c++ objective-c proto"
make compare
make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="c c++ objective-c proto"


and the original libg++-2.7.2:

configure --prefix=/tmp_mnt/users/gen1/le/sun/gnu --exec-prefix=/tmp_mnt/users/gen1/le/sun/gnu --host=sparc-sun-sunos4.1.3_U1 --with-gnu-ld
make all CC="/tmp/gcc-2.7.2.1/xgcc -B/tmp/gcc-2.7.2.1/" CXX="/tmp/gcc-2.7.2.1/xgcc -B/tmp/gcc-2.7.2.1/"
make check
make install


and when I compiled the following:

#include <iostream.h>
#include <stdio.h>

void main()
{
   printf("c works\n");
   cout << "c++ works" << endl;
}

with g++ hello.cpp, I get a linker problem not finding printf.
This occurs with all other standard c functions.

Then Mr Rohan Lenard (rjl@wr.com.au) pointed to me that the
C++ mangled printf. After I put extern "C" {#include <stdio.h>},
then it compiles and links okay.

I modified the fix-header.c and uncommented the line:

/* We no longer need to add extern "C", because cpp implicitly
   forces the standard include files to be treated as C.  */
 #define ADD_MISSING_EXTERN_C 1

and compiled fix-header.c and ran it on all the include files listed
in fix-header.c and everything now works okay.

Is this a bug? did someone mistakenly take it out? the cpp apparently
did not force the standard include files to be C instead of C++.

Well, if someone can enlighten me a little more, I would
appreciate it. Thanks in advance.

Duc T. Le
email: led@eiws.esid.northgrum.com
Technical Details
Message-ID: <m0vkIKa-0002ncC@coltrane.eiws.esid.northgrum.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,a9c26189247badb2,start
X-Google-Attributes: gid113d02,public
From: led@eiws.esid.northgrum.com (Le Duc T.)
Subject: fix-header bug in gcc-2.7.2.1
Date: 1997/01/14
Message-ID: <m0vkIKa-0002ncC@coltrane.eiws.esid.northgrum.com>
X-Deja-AN: 209871675
sender: bug-gcc-request@prep.ai.mit.edu
content-type: text/plain; charset=US-ASCII
x-gateway: relay5.UU.NET from bug-gcc to gnu.gcc.bug; Tue, 14 Jan 1997 18:37:21 EST
mime-version: 1.0
newsgroups: gnu.gcc.bug
x-mailer: ELM [version 2.4 PL24 PGP2]