Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old July 7th, 2008, 07:45 AM
ashnin
Guest
 
Posts: n/a
Default C++ Warning

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?

  #2  
Old July 7th, 2008, 08:35 AM
ToMo
Guest
 
Posts: n/a
Default Re: C++ Warning

ashnin wrote:
Quote:
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
  #3  
Old July 7th, 2008, 08:45 AM
ashnin
Guest
 
Posts: n/a
Default Re: C++ Warning

On Jul 7, 12:37 pm, Michael DOUBEZ <michael.dou...@free.frwrote:
Quote:
ashnin a écrit :
>
Quote:
Hi,
>
Quote:
Can anyone tell me, why am I getting this warning?
>
Quote:
cc1plus: warning: command line option "-Wdeclaration-after-statement"
is valid for C/ObjC but not for C++
>
Quote:
(Actually Im compiling a set of C & C++ files from the same source
dir. )
>
Quote:
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.
Quote:
Quote:
>>>
>
--
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
  #4  
Old July 7th, 2008, 01:55 PM
Yannick Tremblay
Guest
 
Posts: n/a
Default Re: C++ Warning

In article <8cb4e6a3-be9b-4beb-992c-3a3a98fcc35a@d1g2000hsg.googlegroups.com>,
ashnin <ashmitha123@gmail.comwrote:
Quote:
>On Jul 7, 12:37 pm, Michael DOUBEZ <michael.dou...@free.frwrote:
Quote:
>ashnin a écrit :
>>
Quote:
Hi,
>>
Quote:
Can anyone tell me, why am I getting this warning?
>>
Quote:
cc1plus: warning: command line option "-Wdeclaration-after-statement"
is valid for C/ObjC but not for C++
>
>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.
Nobody knows from the information you gave.
We neither know what is your build system nor the command line you are
using to compile.

Typically, "make" might be used. Then you need to look for the
relevant makefile or maybe environment variable. At this point, the
question becomes not a C++ question but probably a GNU make question
and if you need more help, it would be better to ask in a GNU make
specialised newsgroup or mailing list (see: www.gnu.org for how to
find the mailing lists)

Cheers

Yannick

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,338 network members.