public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: streambuf.h:403: parse error before `ios'
@ 2004-05-03  0:19 Boyan Biandov
  2004-05-03  3:32 ` llewelly
  0 siblings, 1 reply; 7+ messages in thread
From: Boyan Biandov @ 2004-05-03  0:19 UTC (permalink / raw)
  To: 'llewelly@xmission.com'; +Cc: 'gcc-help@gcc.gnu.org'

Thanks,

I have few machines, one of which is 3.4.0 under RH9 and I get the same
exact errors. Now a bit of interesting fact I just discovered:

If I use c++ -O3 -o test test.c -Wall -I/usr/include/g++-3/ it compiles just
fine

But gcc -O3 -o test test.c -Wall -I/usr/include/g++-3/ generates parse
errors in fstream and iostream



Boyan


-----Original Message-----
From: llewelly@xmission.com [mailto:llewelly@xmission.com] 
Sent: Sunday, May 02, 2004 4:22 PM
To: Boyan Biandov
Cc: 'gcc-help@gcc.gnu.org'
Subject: Re: streambuf.h:403: parse error before `ios'


Boyan Biandov <bbiandov@SEIU790.org> writes:

> Hello,
> 
> I have seen lots of posting about what I am experiencing but no 
> remedy. I don't get a sense it is a global library issue so I must be 
> doing something wrong. Here is the simplest source code:
> 
> 
> #include <stdio.h>
> #include <sys/io.h>
> #include "/usr/include/g++-3/fstream.h"
[snip]

I vaguely recall <sys/io.h> contains a name or a macro which conflicts
    with something in gcc 2.9x fstream.h . I can't verify this now
    because I don't have 2.9x on linux.

The problem does not occur with gcc 3.2.2 or 3.4.0 on slackware linux
    9.0 .

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: streambuf.h:403: parse error before `ios'
  2004-05-03  0:19 streambuf.h:403: parse error before `ios' Boyan Biandov
@ 2004-05-03  3:32 ` llewelly
  0 siblings, 0 replies; 7+ messages in thread
From: llewelly @ 2004-05-03  3:32 UTC (permalink / raw)
  To: Boyan Biandov; +Cc: 'gcc-help@gcc.gnu.org'

Boyan Biandov <bbiandov@SEIU790.org> writes:

> Thanks,
> 
> I have few machines, one of which is 3.4.0 under RH9 and I get the same
> exact errors. Now a bit of interesting fact I just discovered:
> 
> If I use c++ -O3 -o test test.c -Wall -I/usr/include/g++-3/ it compiles just
> fine


> 
> But gcc -O3 -o test test.c -Wall -I/usr/include/g++-3/ generates parse
> errors in fstream and iostream
[snip]

This is a different problem. 'gcc' will assume a '.c' file is C, not
    C++. However, 'g++' will assume a '.c' file is C++, not C.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: streambuf.h:403: parse error before `ios'
  2004-05-03  4:30 Boyan Biandov
@ 2004-05-03 16:16 ` llewelly
  0 siblings, 0 replies; 7+ messages in thread
From: llewelly @ 2004-05-03 16:16 UTC (permalink / raw)
  To: Boyan Biandov; +Cc: 'gcc-help@gcc.gnu.org'

Boyan Biandov <bbiandov@SEIU790.org> writes:

> Excellent, this will explain the behavior. What is the default assumption
> meaning what file extension would each compiler assume and also how would
> one force the compiler to ignore the extension as a language descriptor and
> interpret it as specified by the user (may be a command line parameter here)
[snip]

g++ always ignores file name extensions, and assumes C++ .
gcc assumes .c is C, .cc, .cpp, .cxx, and .C are C++ . But gcc doesn't
    link in the standard C++ library, or C++ runtime, so it doesn't
    work for C++

The -x flag (see http://xrl.us/byzf) can be used to specify the
    langauge, overriding the above behaviors for *compilation*, but it
    doesn't change the linking behaviors.

Just use 'gcc' for C, and 'g++' for C++ .


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: streambuf.h:403: parse error before `ios'
@ 2004-05-03 15:56 lrtaylor
  0 siblings, 0 replies; 7+ messages in thread
From: lrtaylor @ 2004-05-03 15:56 UTC (permalink / raw)
  To: bbiandov; +Cc: gcc-help

I believe that "-x c++" will tell the compiler to interpret the source
file as C++ source code.  You can look up the option to see what else it
supports.  I believe that *.c files are interpreted as C source files
while *.cpp, *.cc, *.C, *.cxx and maybe *.c++ are all assumed to be C++
source files.  It is probably bad practice to put C++ code in *.c files.
Also, when linking C++ programs and libraries, you really should use g++
instead of gcc, regardless of how you've named your files.

Cheers,
Lyle

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Boyan Biandov
Sent: Sunday, May 02, 2004 10:30 PM
To: 'llewelly@xmission.com'
Cc: 'gcc-help@gcc.gnu.org'
Subject: RE: streambuf.h:403: parse error before `ios'

Excellent, this will explain the behavior. What is the default
assumption
meaning what file extension would each compiler assume and also how
would
one force the compiler to ignore the extension as a language descriptor
and
interpret it as specified by the user (may be a command line parameter
here)

thanks

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: streambuf.h:403: parse error before `ios'
@ 2004-05-03  4:30 Boyan Biandov
  2004-05-03 16:16 ` llewelly
  0 siblings, 1 reply; 7+ messages in thread
From: Boyan Biandov @ 2004-05-03  4:30 UTC (permalink / raw)
  To: 'llewelly@xmission.com'; +Cc: 'gcc-help@gcc.gnu.org'

Excellent, this will explain the behavior. What is the default assumption
meaning what file extension would each compiler assume and also how would
one force the compiler to ignore the extension as a language descriptor and
interpret it as specified by the user (may be a command line parameter here)

thanks

-----Original Message-----
From: llewelly@xmission.com [mailto:llewelly@xmission.com] 
Sent: Sunday, May 02, 2004 8:32 PM
To: Boyan Biandov
Cc: 'gcc-help@gcc.gnu.org'
Subject: Re: streambuf.h:403: parse error before `ios'


Boyan Biandov <bbiandov@SEIU790.org> writes:

> Thanks,
> 
> I have few machines, one of which is 3.4.0 under RH9 and I get the 
> same exact errors. Now a bit of interesting fact I just discovered:
> 
> If I use c++ -O3 -o test test.c -Wall -I/usr/include/g++-3/ it 
> compiles just fine


> 
> But gcc -O3 -o test test.c -Wall -I/usr/include/g++-3/ generates parse 
> errors in fstream and iostream
[snip]

This is a different problem. 'gcc' will assume a '.c' file is C, not
    C++. However, 'g++' will assume a '.c' file is C++, not C.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: streambuf.h:403: parse error before `ios'
  2004-05-02 18:22 Boyan Biandov
@ 2004-05-02 23:22 ` llewelly
  0 siblings, 0 replies; 7+ messages in thread
From: llewelly @ 2004-05-02 23:22 UTC (permalink / raw)
  To: Boyan Biandov; +Cc: 'gcc-help@gcc.gnu.org'

Boyan Biandov <bbiandov@SEIU790.org> writes:

> Hello,
> 
> I have seen lots of posting about what I am experiencing but no remedy. I
> don't get a sense it is a global library issue so I must be doing something
> wrong. Here is the simplest source code:
> 
> 
> #include <stdio.h>
> #include <sys/io.h>
> #include "/usr/include/g++-3/fstream.h"
[snip]

I vaguely recall <sys/io.h> contains a name or a macro which conflicts
    with something in gcc 2.9x fstream.h . I can't verify this now
    because I don't have 2.9x on linux.

The problem does not occur with gcc 3.2.2 or 3.4.0 on slackware linux
    9.0 .

^ permalink raw reply	[flat|nested] 7+ messages in thread

* streambuf.h:403: parse error before `ios'
@ 2004-05-02 18:22 Boyan Biandov
  2004-05-02 23:22 ` llewelly
  0 siblings, 1 reply; 7+ messages in thread
From: Boyan Biandov @ 2004-05-02 18:22 UTC (permalink / raw)
  To: 'gcc-help@gcc.gnu.org'

Hello,

I have seen lots of posting about what I am experiencing but no remedy. I
don't get a sense it is a global library issue so I must be doing something
wrong. Here is the simplest source code:


#include <stdio.h>
#include <sys/io.h>
#include "/usr/include/g++-3/fstream.h"
ofstream SaveFile("test.txt");
SaveFile << "Test Log File\n";
SaveFile.close();

The command to compile is gcc -O3 -o test test.c -Wall
-I/usr/include/g++-3/fstream.h

I use gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
I get ton and ton of parse erros in different lib files such as streambuf.h
and iostream.h. Here is an exmaple of what it looks like:

/usr/include/g++-3/streambuf.h:402: `_IO_read_ptr' undeclared (first use in
this function)
/usr/include/g++-3/streambuf.h:402: `_IO_read_end' undeclared (first use in
this function)
/usr/include/g++-3/streambuf.h: At top level:
/usr/include/g++-3/streambuf.h:403: parse error before `ios'
/usr/include/g++-3/streambuf.h:404: parse error before `...'
/usr/include/g++-3/streambuf.h:406: parse error before `...'
/usr/include/g++-3/streambuf.h:411: syntax error before `streamsize'
/usr/include/g++-3/streambuf.h:412: syntax error before `streamsize'
/usr/include/g++-3/streambuf.h:413: syntax error before `streampos'
/usr/include/g++-3/streambuf.h:413: parse error before `_seek_dir'
/usr/include/g++-3/streambuf.h:414: syntax error before `int'
/usr/include/g++-3/streambuf.h:415: syntax error before `int'
/usr/include/g++-3/streambuf.h:417: syntax error before `int'
/usr/include/g++-3/streambuf.h:418: syntax error before `void'
/usr/include/g++-3/streambuf.h:420: parse error before `}'
/usr/include/g++-3/streambuf.h:425: parse error before `filebuf'
/usr/include/g++-3/streambuf.h:430: warning: data definition has no type or
storage class
/usr/include/g++-3/streambuf.h:431: warning: data definition has no type or
storage class
/usr/include/g++-3/streambuf.h:432: conflicting types for `filebuf'
/usr/include/g++-3/streambuf.h:431: previous declaration of `filebuf'
/usr/include/g++-3/streambuf.h:432: warning: data definition has no type or
storage class
/usr/include/g++-3/streambuf.h:436: parse error before `~'
/usr/include/g++-3/streambuf.h:437: warning: data definition has no type or
storage class
/usr/include/g++-3/streambuf.h:438: parse error before `*'
/usr/include/g++-3/streambuf.h:438: warning: data definition has no type or
storage class
/usr/include/g++-3/streambuf.h:439: parse error before `*'
/usr/include/g++-3/streambuf.h:439: parse error before `ios'
/usr/include/g++-3/streambuf.h:439: warning: data definition has no type or
storage class
/usr/include/g++-3/streambuf.h:440: syntax error before `int'
/usr/include/g++-3/streambuf.h:441: syntax error before `int'
/usr/include/g++-3/streambuf.h:441: parse error before `='
/usr/include/g++-3/streambuf.h: In function `is_open':
/usr/include/g++-3/streambuf.h:442: parse error before `{'
/usr/include/g++-3/streambuf.h:443: `_fileno' undeclared (first use in this
function)
/usr/include/g++-3/streambuf.h: At top level:
/usr/include/g++-3/streambuf.h:444: parse error before `*'
/usr/include/g++-3/streambuf.h:444: warning: data definition has no type or
storage class
/usr/include/g++-3/streambuf.h:445: syntax error before `int'
/usr/include/g++-3/streambuf.h:446: syntax error before `streampos'
/usr/include/g++-3/streambuf.h:446: parse error before `_seek_dir'
/usr/include/g++-3/streambuf.h:447: parse error before `streambuf'
/usr/include/g++-3/streambuf.h:447: warning: data definition has no type or
storage class
/usr/include/g++-3/streambuf.h:450: syntax error before `int'

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-05-03 16:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-03  0:19 streambuf.h:403: parse error before `ios' Boyan Biandov
2004-05-03  3:32 ` llewelly
  -- strict thread matches above, loose matches on Subject: below --
2004-05-03 15:56 lrtaylor
2004-05-03  4:30 Boyan Biandov
2004-05-03 16:16 ` llewelly
2004-05-02 18:22 Boyan Biandov
2004-05-02 23:22 ` llewelly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).