[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing flags to C compiler but not to C++ compiler

From: Robert Boehne
Subject: Re: passing flags to C compiler but not to C++ compiler
Date: Mon, 29 Jul 2013 11:44:06 -0500
User-agent: Mozilla/5.0 (X11; SunOS i86pc; rv:14.0) Gecko/20120714 Thunderbird/14.0

On 07/29/13 10:55, Vincent Torri wrote:
On Mon, Jul 29, 2013 at 5:17 PM, Robert Boehne <address@hidden> wrote:
On 07/27/13 16:26, Vincent Torri wrote:
On Sat, Jul 27, 2013 at 10:24 PM, Robert Boehne <address@hidden>

On 07/27/13 00:32, Vincent Torri wrote:

in my sources, i have both C and C++ files. Something like

my_lib_la_SOURCES = foo.c foo.cpp

I want to pass, for example, -Wdeclaration-after-statement to gcc.
when compiling foo.cpp, i have the warning :

cc1plus.exe: warning: command line option
is valid for C/ObjC but not for C++

How can I remove this warning when compiling c++ files ?

thank you

Vincent Torri

I misread - for C and not C++ you should set "CFLAGS"

./configure CFLAGS="-g -O2 -Wdeclaration-after-statement" CXXFLAGS="-g
it will still not work as $(CFLAGS) will be passed to the compilation
of the c++ source file

Vincent Torri

Are you saying you've tried it?
1) yes i tried it

2) the fact that I have the warning proves that CFLAGS is passed to
the C++ compiler...

Vincent Torri

  That's not my understanding of how Automake
(or GNU Make) works.  Unless the project has overridden the default
use for these variables, that's how it's supposed to work, and
this problem is an example of why.

This is the relevant section of the manual:

Then that would be a bug, and you should post enough information
that it can be reproduced, like a tarball of your sources and which version you're using.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]