简体   繁体   中英

Where are the GCC flags for MAKE being passed from?

I'm working on an existing project locally. I am new to the project, so I am using the supplied make files as-is. I modified some code, ran make , and the build passed.

When I push the changes to github, the automated Travis CI build detected a compile error.

Searching for the error here on StackOverflow showed me that it is an error in pre-C++11, but not an error is C++11 and later.

This means that my local make must be compiling with the C++11 flag on, while the Travis CI build on the server is compiling without the flag.

Ideally I'd like my local build conditions to match the server build conditions so that I can detect any errors before pushing.

Where can I see the flags being passed to GCC for my local make operation, or is there some other way to explicitly disable the C++11 compilation flag?

Say you have some all target, that is used to build the main stuff:

all: (some dependencies)
    (some commands)

To make sure at build-time what flags are used, you can add some dummy dependency:

all: (some dependencies) showflags
    (some commands)

showflags:
    @echo "CXXFLAGS=$(CXXFLAGS)"
    @echo "CPPFLAGS=$(CPPFLAGS)"

At least you will be able to see what options are used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM