Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > C++ Warning

Reply
Thread Tools

C++ Warning

 
 
ashnin
Guest
Posts: n/a
 
      07-07-2008
Hi,

Can anyone tell me, why am I getting this warning?

cc1plus: warning: command line option "-Wdeclaration-after-statement"
is valid for C/ObjC but not for C++

(Actually Im compiling a set of C & C++ files from the same source
dir. )

What should be done to avoid this warning?

 
Reply With Quote
 
 
 
 
ToMo
Guest
Posts: n/a
 
      07-07-2008
ashnin wrote:
> Hi,
>
> Can anyone tell me, why am I getting this warning?
>
> cc1plus: warning: command line option "-Wdeclaration-after-statement"
> is valid for C/ObjC but not for C++
>
> (Actually Im compiling a set of C & C++ files from the same source
> dir. )
>
> What should be done to avoid this warning?


This often happens when you have the same set of switches/options for
both C and C++ compilers. This warning obviously doesn't make sense in
C++ language, but it does for C language.
--
ToMo
 
Reply With Quote
 
 
 
 
Michael DOUBEZ
Guest
Posts: n/a
 
      07-07-2008
ashnin a écrit :
> Hi,
>
> Can anyone tell me, why am I getting this warning?
>
> cc1plus: warning: command line option "-Wdeclaration-after-statement"
> is valid for C/ObjC but not for C++
>
> (Actually Im compiling a set of C & C++ files from the same source
> dir. )
>
> What should be done to avoid this warning?
>


You should simply remove it from your build system unless you want the
old C declaration system that required variables to be declared at the
beginning of a block.

In all cases, you should remove it from the rule processing c++ files.

Looking into the man of gcc:
<<<
C-only Warning Options
[...] -Wdeclaration-after-statement [...]

-Wdeclaration-after-statement (C only)
Warn when a declaration is found after a statement in a block. This
construct, known from C ++ , was introduced with ISO C99 and is by
default allowed in GCC . It is not supported by ISO C90 and was not
supported by GCC versions before GCC 3.0.
>>>


--
Michael
 
Reply With Quote
 
ashnin
Guest
Posts: n/a
 
      07-07-2008
On Jul 7, 12:37 pm, Michael DOUBEZ <(E-Mail Removed)> wrote:
> ashnin a écrit :
>
> > Hi,

>
> > Can anyone tell me, why am I getting this warning?

>
> > cc1plus: warning: command line option "-Wdeclaration-after-statement"
> > is valid for C/ObjC but not for C++

>
> > (Actually Im compiling a set of C & C++ files from the same source
> > dir. )

>
> > What should be done to avoid this warning?

>
> You should simply remove it from your build system unless you want the
> old C declaration system that required variables to be declared at the
> beginning of a block.
>
> In all cases, you should remove it from the rule processing c++ files.
>
> Looking into the man of gcc:
> <<<
> C-only Warning Options
> [...] -Wdeclaration-after-statement [...]
>
> -Wdeclaration-after-statement (C only)
> Warn when a declaration is found after a statement in a block. This
> construct, known from C ++ , was introduced with ISO C99 and is by
> default allowed in GCC . It is not supported by ISO C90 and was not
> supported by GCC versions before GCC 3.0.
> >>>

>
> --
> Michael


Thanks. But I never included this option in command line. Then how
come it is throwing this warning?
Please tell me how to remove it from my build system.

Regards
ashnin
 
Reply With Quote
 
Michael DOUBEZ
Guest
Posts: n/a
 
      07-07-2008
ashnin a écrit :
> On Jul 7, 12:37 pm, Michael DOUBEZ <(E-Mail Removed)> wrote:
>> ashnin a écrit :
>>
>>> Hi,
>>> Can anyone tell me, why am I getting this warning?
>>> cc1plus: warning: command line option "-Wdeclaration-after-statement"
>>> is valid for C/ObjC but not for C++
>>> (Actually Im compiling a set of C & C++ files from the same source
>>> dir. )
>>> What should be done to avoid this warning?

>> You should simply remove it from your build system


[snip]

> Thanks. But I never included this option in command line. Then how
> come it is throwing this warning?
> Please tell me how to remove it from my build system.


How would I know ? I think it best your look into your documentation or
ask the guy who set it up.

Please ask in a group relevant to your build system.

--
Michael
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WARNING! Prosoftstore.com is a SCAM! WARNING! pentologer@gmail.com ASP .Net Web Services 0 07-08-2007 10:03 AM
warning C4267 and warning C4996 B. Williams C++ 17 10-27-2006 09:41 PM
Untraceable warning: "Warning: Use of "require" without parenthesesis ambiguous at (eval 23) line 1." Julian Mehnle Perl Misc 17 05-18-2006 11:00 AM
Warning: WARNING Charles Computer Support 7 08-16-2005 09:07 PM
Re: A code fix for MSVC warning C4267 (64-bit compatibility warning,e.g. Boost Spirit) Pete Becker C++ 0 02-10-2005 01:13 PM



Advertisments