473,657 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8035
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************ *************** *******@d1g2000 hsg.googlegroup s.com>,
ashnin <as*********@gm ail.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
2717
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 storage Keywords.Keyword reachable from global A global variable does not satisfy its annotations when control is transferred. (Use -globstate to inhibit warning) keywords.c:60:11: Storage Keywords.Keyword released
3
2559
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 libs; use /NODEFAULTLIB:library Here is the compiler options: /Od /I "C:\DriverX4\Include" /I "..\ThreadLib" /AI "..\Utility\bin\Debug" /AI "..\Logging\bin\Debug" /AI "Debug" /D "WIN32" /D "_DEBUG" /D "_WINDLL"
3
7202
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 'mscorlib' (Signature='B77A5C561934E089' Version='1.0.5000.0') of assembly 'System.dll' WARNING: Unable to find dependency 'mscorlib' (Signature='B77A5C561934E089' Version='1.0.5000.0') of assembly 'System.Windows.Forms.dll' WARNING: Unable to...
1
1997
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: curses.h: check for missing prerequisite headers? configure: WARNING: curses.h: see the Autoconf documentation configure: WARNING: curses.h: section "Present But Cannot Be Compiled" configure: WARNING: curses.h: proceeding with the...
5
5082
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 is as follows Warning CA2122 : Microsoft.Security : MyClass.Method():Void calls into Marshal.GetExceptionPointers():IntPtr which has a LinkDemand. By making this call, Marshal.GetExceptionPointers():IntPtr is indirectly exposed to user code....
1
6408
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 monitor::enter/try/finally/monitor exit. However, I cannot get around one of the warning messages and am requesting help in understanding what is causing the warning. All of the online sample code for the class msclr::lock generates the same warning message. I have...
5
1864
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
6187
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
2147
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; } By definition, readonly fields can only be initialized inside a
0
8421
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8325
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.