Xcode .m vs. .mm

xcode

Solution

.mm extension stands for Objective-C++, when compiler can process C++ classes. But when using .m extension it will be able to compile only C code, without C++ classes.

Problem

In the zxing iphone project the readme states: - 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 It did indeed. But I'm wondering why?

Original source