[英]XCode compiler error, with a project built using CMake
I'm trying to build a XCode (version 5.0) project that was generated from CMake 3.x. 我正在尝试构建从CMake 3.x生成的XCode(5.0版)项目。
clang compiler version:
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
When I try to build the project 当我尝试建立专案时
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch x86_64 blah blah -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk blah blah -Wno-unknown-pragmas -F/usr/local/bin/Debug ;**-std=c++0x -stdlib=libc++** -Wall -MMD -MT blah blah
I get this error: 我收到此错误:
clang: error: no such file or directory: ';-std=c++0x'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
How can I fix this error? 如何解决此错误?
-std and -stdlib are coming from these project properties: Apple LLVM 5.0 - Language C++ ==> Dialect and Standard library -std和-stdlib来自以下项目属性:Apple LLVM 5.0-语言C ++ ==>方言和标准库
How do I set this from CMAKE? 我该如何从CMAKE设置?
If I recall correctly there is no c++0x
language dialect in Xcode 5, but there is a c++11
dialect. 如果我没c++0x
话,Xcode 5中没有c++0x
语言方言,但是有c++11
方言。
These properties can be changed in the CMake project in two ways: 可以通过两种方式在CMake项目中更改这些属性:
CMAKE_XCODE_ATTRIBUTE_
and then the name of the attribute you see in the Xcode project (我从来没有设法做到这一点),方法是先设置CMAKE_XCODE_ATTRIBUTE_
,然后再设置Xcode项目中看到的属性名称 CMAKE_CXX_FLAGS
variable 通过设置“通用”编译器属性CMAKE_CXX_FLAGS
变量 There is a stray semi-colon in that command line: 该命令行中有一个冒号分号:
-F/usr/local/bin/Debug ;-std=c++0x -stdlib=libc++
^
So the shell is seeing two commands; 因此,shell看到了两个命令: the first starts with c++
and the second with -std=c++0x
. 第一个以c++
开头,第二个以-std=c++0x
。 Find and remove that semi-colon and it should start working. 找到并删除该分号,它应该开始工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.