public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: compiles under g++ but not gcc
       [not found] <1093582054.1431.7.camel@darkstar.org>
@ 2004-08-27  7:08 ` Zack Weinberg
  0 siblings, 0 replies; only message in thread
From: Zack Weinberg @ 2004-08-27  7:08 UTC (permalink / raw)
  To: sol; +Cc: gcc, gcc-help

sol <sol@avalon.pascal-central.com> writes:

> Hello, not sure I'm posting this to the right list, but I couldn't seem
> to find any others.

This question is appropriate for gcc-help@gcc.gnu.org, or for a
general learning-to-program group, but not for gcc@gcc.gnu.org.
gcc@gcc.gnu.org is for discussion of development _of_, not _with_,
gcc.

I will answer this question anyway, but please do not post further
such questions.

> I've noticed a problem compiling under g++ and gcc. a program I am
> working on compiles fine under g++, but gives a number of errors
> with gcc.  I have defined a simple structure in a header file,
> included this header in the main file that uses this structure, and
> when I compile under gcc, I get errors related to all variables of
> that structure type (the one defined in the header); it does not
> recognize the structure type that was defined in the header. When
> compiling under g++, there is no problem at all.

Since you did not show us any code, I can only guess what your problem
is.  You have probably run afoul of a well-known difference between C
and C++.  In C++, if you write

    struct S { int whatever; };

you may then write 

    S variable;

In C by contrast you must write

    struct S variable;

unless you use a typedef to define 'S' as equivalent to 'struct S'.

zw

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-08-27  5:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1093582054.1431.7.camel@darkstar.org>
2004-08-27  7:08 ` compiles under g++ but not gcc Zack Weinberg

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).