[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: |
Sat, 27 Jul 2013 15:24:33 -0500 |
User-agent: |
Mozilla/5.0 (X11; SunOS i86pc; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
On 07/27/13 00:32, Vincent Torri wrote:
hello
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. Hence,
when compiling foo.cpp, i have the warning :
cc1plus.exe: warning: command line option '-Wdeclaration-after-statement'
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 -O2"
for example. If you want to pass something to the preprocessor,
it's used by both C and C++, use CPPFLAGS
CPPFLAGS="-DSYMBOL=value -I/path/to/headers"
You can set them in the environment, but if you use the syntax where
it's after
the configure in the command, those settings will be saved in config.log
so you can see what they were set to when you built.
HTH,
Robert Boehne
Re: passing flags to C compiler but not to C++ compiler, Robert Boehne, 2013/07/27