Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top