This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: compiles under g++ but not gcc
- From: Zack Weinberg <zack at codesourcery dot com>
- To: sol <sol at avalon dot pascal-central dot com>
- Cc: gcc at gcc dot gnu dot org, gcc-help at gcc dot gnu dot org
- Date: Thu, 26 Aug 2004 22:18:54 -0700
- Subject: Re: compiles under g++ but not gcc
- References: <1093582054.1431.7.camel@darkstar.org>
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