xcode 对象文件是为比被链接的新 OSX 版本构建的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43216273/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Object file was built for newer OSX version than being linked
提问by peetonn
I'm getting this error for C++ library I'm using. It uses GNU Automake for building. Which flag(s) I should supply for the make
command to lower the target build platform to avoid seeing this warning in Xcode project where I'm trying to link against the library?
我正在使用的 C++ 库出现此错误。它使用 GNU Automake 进行构建。我应该为make
命令提供哪个标志来降低目标构建平台以避免在我尝试链接库的 Xcode 项目中看到此警告?
回答by cbrnr
You need to set the compiler flag -mmacosx-version-min
to the version number of the SDK you want to build against. I don't use automake
, but in cmake
you'd set the variable CMAKE_OSX_DEPLOYMENT_TARGET
, and in qmake
you'd set the variable QMAKE_MACOSX_DEPLOYMENT_TARGET
.
您需要将编译器标志设置为-mmacosx-version-min
要针对其构建的 SDK 的版本号。我不使用automake
,但在cmake
你设置变量时CMAKE_OSX_DEPLOYMENT_TARGET
,qmake
你会设置变量QMAKE_MACOSX_DEPLOYMENT_TARGET
。
回答by MateuszL
As cbrnr answered, you have to use -mmacosx-version-min compiler flag. To pass compiler flag through make, you can use CXXFLAGS environment variable:
正如 cbrnr 回答的那样,您必须使用 -mmacosx-version-min 编译器标志。要通过 make 传递编译器标志,您可以使用 CXXFLAGS 环境变量:
make CXXFLAGS="-mmacosx-version-min=10.10" <target or other make params>