Re: getting copilation error with gcc 3.4.2

From: Keith Thompson (kst-u_at_mib.org)
Date: 02/22/05


Date: Tue, 22 Feb 2005 22:08:52 GMT


"Ashay" <saurabh_verma78@yahoo.com> writes:
> I am getting compilation error "error: parse error before
> "__extension__"" for following line of 'C' code:
>
> extern char *strchr(const char *s, int c);
> ("I had to put this line for some other reasons")
>
> I am using gcc 3.4.2. And, this error is coming only with '-O' option.
> With '-g', it is compiling.
>
> Can somebody please help me out.

I presume the ("I had to put this line for some other reasons") is
your comments, and doesn't appear in the source.

Probably strchr is defined as a function-like macro whose definition
uses some non-standard extension called "__extension__".

The way to get the declaration for strchr() is "#include <string.h>".
Why do you need to declare it yourself?

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
We must do something.  This is something.  Therefore, we must do this.


Relevant Pages

  • Re: linking C++ functions in a C program
    ... Keith Thompson wrote in message ... actually compiling with g++ the main works. ... normally altered by the C++ compiler for various reasons. ... defines the mechanism for doing this in both directions. ...
    (comp.lang.c)
  • Re: Pain and Human Development/ question of ethics 4 Hawki
    ... The whole Arthritis Insight site was sold. ... Nah...it's easier just to presume ... > How would I know what "other" peoples reasons for doing things are. ...
    (alt.support.chronic-pain)
  • Re: Should this group be split?
    ... out of hand and won't expand on your reasons even when asked. ... not presume that "foundation oriented posters" are a nuisance ... But the foundations of mathematics are not just another topic ...
    (sci.math)
  • Re: adding dither in audio signals
    ... I had certain querries about adding dither in audio signals. ... I presume one of the reasons to add it is to compensate for ...
    (comp.dsp)
  • Re: Are there instructutions for installing slrn on SimplyMepis?
    ... These reasons could apply to any software. ... people's reason for compiling from source code recently (certainly ... mine) is that they want unofficial bugfixes for certain problems ...
    (news.software.readers)