Article View: gnu.gcc.help
Article #50731Problems with gcc/g++ under Coherent
From: Ray Dzurney
Date: Mon, 16 Aug 1993 20:44
Date: Mon, 16 Aug 1993 20:44
106 lines
4420 bytes
4420 bytes
Greetings:
I seem to be having a problem with gcc and g++. This is the first time I
am using the GNU compiler and the problem could very well be me.
I am using the compiler on Coherent v4.0.1 (r74 version of the kernel).
I have called the Mark Williams Company concerining this problem but they
could not help me.
The first problem is with gcc. When I try to compile a standard
"hello, world" program, the compiler produces the following:
Reading specs from /usr/local/lib/gcc-lib/i386-coh/2.3.2/specs
gcc version 2.3.2
/usr/local/lib/gcc-lib/i386-coh/2.3.2/cpp -lang-c -v -undef -D__GNUC__=2
-DCOHERENT -D_I386 -D_IEEE -D__COHERENT__ -D___I386__ -D___IEEE__
-D__COHERENT -D___I386 -D___IEEE hello.c /usr/rayd/tmp/cc00495a.i
GNU CPP version 2.3.2 (80386, ATT syntax)
/usr/local/lib/gcc-lib/i386-coh/2.3.2/cc1 /usr/rayd/tmp/cc00495a.i -quiet
-dumpbase hello.c -version -o /usr/rayd/tmp/cc00495a.s
GNU C version 2.3.2 (80386, ATT syntax) compiled by GNU C version 2.3.2.
In file included from hello.c:1:
/usr/local/lib/gcc-lib/i386-coh/2.3.2/g++-include/stdio.h:1:
parse error before `/'
In file included from hello.c:1:
/usr/local/lib/gcc-lib/i386-coh/2.3.2/g++-include/stdio.h:108:
parse error before `}'
/usr/local/lib/gcc-lib/i386-coh/2.3.2/g++-include/stdio.h:118:
parse error before `...'
/usr/local/lib/gcc-lib/i386-coh/2.3.2/g++-include/stdio.h:127:
parse error before `...'
/usr/local/lib/gcc-lib/i386-coh/2.3.2/g++-include/stdio.h:136:
parse error before `...'
/usr/local/lib/gcc-lib/i386-coh/2.3.2/g++-include/stdio.h:140:
parse error before `...'
/usr/local/lib/gcc-lib/i386-coh/2.3.2/g++-include/stdio.h:145:
parse error before `...'
/usr/local/lib/gcc-lib/i386-coh/2.3.2/g++-include/stdio.h:156:
parse error before `}'
The invokation for the compiler is as follows:
gcc -v hello.c
It seems to choke on stdio.h. I looked at the header file and there
are C++ comments sprinkled through the file. Could these be the problem?
The hello.c file is the same old program everyone is familiar with ever
since the first edition of the K&R book came out.
The second problem is with g++ (c++). I can't seem to be able to read
text from an ASCII file. The test file I am using is as follows:
............................................................
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
const char *fname = "t";
int
main()
{
ifstream fd(fname,ios::nocreate);
char buf[81];
if (!fd) {
cerr << "error: Cannot open file 't'" << endl;
exit(1);
}
while (!fd.eof()) {
fd.getline(buf,sizeof(buf),'\n');
cout << buf << endl;
}
fd.close(); // Not really necessary, but just in case . . .
return 0;
}
............................................................
The compiler invokation for this file is :
c++ -v ts.C
The file ts.C is the above code. Under DOS I renamed the file ts.cpp.
The code actually does run, it doesn't produce core dumps or write
funny characters to the screen; it just dosen't do anything. When I
execute the code, the prompt just comes back without displaying the
text file.
I have successfully compiled and run this code under Borland C++ v3.1
and Microsoft C/C++ 7.0. The file "t" is a two line text file that was
created with emacs just for testing purposes. This code does compile fine
under g++, it just dosen't do what it should. Could it be the iostream
library?
Any help in this matter is greatly appreciated. Thanks in advance :^)
Ray Dzurney
rayd@src4src.linet.org
Technical Details
Message-ID:
<m0oS7kf-00001RC@src4src.linet.org>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!src4src.linet.ORG!raydShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,817b5469174a8a56,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-08-16 14:39:58 PST Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!src4src.linet.ORG!rayd From: rayd@src4src.linet.ORG (Ray Dzurney) Newsgroups: gnu.gcc.help Subject: Problems with gcc/g++ under Coherent Date: 16 Aug 1993 16:44:15 -0400 Organization: GNUs Not Usenet Lines: 107 Sender: daemon@cis.ohio-state.edu Distribution: gnu Message-ID: <m0oS7kf-00001RC@src4src.linet.org>