clang -fmodules -framework Foundation test.mm; ./a.out
小测试文件:
#import <stdio.h>// #import <Foundation/Foundation.h>@import Foundation;/*clang -fmodules -framework Foundation test.mm; ./a.out */int main(int argc,char const *argv[]){ Nsstring *hello = @"Hello"; printf("%s\n","hello world"); return 0;}解决方法 您的输入文件是Objective-C(来自.mm扩展名),但模块还没有为C做好准备.有一个单独的标志,-fcxx-modules,但即使你使用它,你很可能会失败.要使用模块,您现在必须坚持使用C和Objective-C.
对于C和Objective-C,这应该适用于Xcode 5和OS X 10.9中的clang.
@import Foundation;int main() { Nsstring *hello = @"Hello"; NSLog(@"%@",hello);}⑆ clang -vApple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)Target: x86_64-apple-darwin13.0.0Thread model: posix⑆ clang -fmodules main.m && ./a.out2013-11-20 08:51:37.638 a.out[51425:507] Hello总结
以上是内存溢出为你收集整理的ios – 使用来自clang的@import?全部内容,希望文章能够帮你解决ios – 使用来自clang的@import?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)