[英]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. 我是该项目的新手,所以我按原样使用提供的
make
文件。 I modified some code, ran make
, and the build passed. 我修改了一些代码,运行了
make
,并通过了构建。
When I push the changes to github, the automated Travis CI build detected a compile error. 当我将更改推送到github时,自动的Travis CI构建会检测到编译错误。
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. 在StackOverflow上搜索错误后,我发现这是C ++ 11之前的版本中的错误,但C ++ 11及更高版本中没有错误。
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. 这意味着我的本地
make
必须在启用C ++ 11标志的情况下进行编译,而在服务器上构建的Travis CI构建时不使用该标志。
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? 我在哪里可以看到为我的本地
make
操作传递给GCC的标志,还是有其他方法可以显式禁用C ++ 11编译标志?
Say you have some all
target, that is used to build the main stuff: 假设您有一些
all
目标,用于建立主要目标:
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. 至少您将能够看到使用了哪些选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.