Xcode .m 与 .mm

标签 xcode

在 zxing iphone 项目中,自述文件指出:

  • It can happen that when trying to build your own project with ZXingWidgetController you get linker errors like "undefined reference to". If this error looks like a c++ undefined reference, then renaming main.m into main.mm (Objective-C++ source suffix) may fix the problem


确实如此。但我想知道为什么?

最佳答案

.mm 扩展名代表 Objective-C++,当编译器可以处理 C++ 类时。
但是当使用 .m 扩展名时,它只能编译 C 代码,而没有 C++ 类。

关于Xcode .m 与 .mm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4562255/

相关文章:

objective-c - 向 UIMapView 添加更多注释

xcode - 安装 Cassandra 时出现错误

ios - 如何以编程方式配置 SWRevealViewController?

xcode - 如何在 Swift 3.0 中使用@asmname()

iphone - 调试版本工作,发布版本失败-llvm-gcc-4.2失败,退出代码为1

iphone - 难以理解通用应用程序、多个 View Controller

swift - 将数据从 View Controller 传递到 tabbarcontroller

iphone - 无法从 Url 将 UIImage 设置为 UIImageView?

ios - 数据格式错误,因此无法读取。存档时

ios - XIB TableViewCell 未调整大小以适应宽度