473,320 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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?

Jul 7 '08 #1
3 8007
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
Jul 7 '08 #2
On Jul 7, 12:37 pm, Michael DOUBEZ <michael.dou...@free.frwrote:
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
Jul 7 '08 #3
In article <8c**********************************@d1g2000hsg.g ooglegroups.com>,
ashnin <as*********@gmail.comwrote:
>On Jul 7, 12:37 pm, Michael DOUBEZ <michael.dou...@free.frwrote:
>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++

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

Jul 7 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bas Wassink | last post by:
Hello there, I'm having trouble understanding a warning produced by 'splint', a code-checker. The warning produced is: keywords.c: (in function keyw_get_string) keywords.c:60:31: Released...
3
by: Bill Burris | last post by:
How do I find what is causing this warning from the Linker? If I use /NODEFAULTLIB I get hundreds of undefined symbols. LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other...
3
by: DJTN | last post by:
I'm getting the following error when I try to compile my setup project in VS 2002. I have re-installed the .net framework 1.1 and it didnt solve the problem. WARNING: Unable to find dependency...
1
by: spanov | last post by:
i've got problem installing python-2.3.5 from sources on FreeBSD 5.3 root@server# ./configure > conf_log configure: WARNING: curses.h: present but cannot be compiled configure: WARNING:...
5
by: Peter Ritchie [C# MVP] | last post by:
I've purposely been ignoring a CA2122 warning in some C++ interop code I've been working on for quite some time. I've just recently had the cycles to investigate the warning. The warning message...
1
by: Ian | last post by:
I've just discovered the msclr::lock class in the C++ Support Library online documentation. This seems like a much cleaner way to implement thread protection than using...
5
by: holmescn | last post by:
what is the meaning of warning attributes ignored on template instantiation. i got it when i compiled stlport 5.1.3. anybody can help me ? thx!
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
4
by: cody | last post by:
It is possible to declare and use/instantiate a class with a uninitialized readonly field without even a compiler warning. Why don't I get warnings? public class Stuff { public readonly int a;...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.