在 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/