Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode .m vs. .mm

Tags:

xcode

People also ask

What does .m mean in Objective-C?

In objective C, files normally use the extension . h for interface files and the extension . m for implementation files.

What is .MM file Xcode?

An MM file is a source code file that can contain both Objective-C and Objective-C++ programming code. It is used on MacOS and differentiates from .

How do I create a .MM file in Xcode?

You just need to change the extension to . mm. There is no option to create a file with . mm extension in Xcode.

What is the difference between .m and .MM file?

mm are class file extensions of source code for Mac-based applications. . m files can contain both Objective-C and Objective-C++ classes. To avoid conflicts between the two in mixed-use scenarios there's the convention to rename all Objective-C++ class files to . mm .


.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.


Both .m and .mm are class file extensions of source code for Mac-based applications. .m files can contain both Objective-C and Objective-C++ classes. To avoid conflicts between the two in mixed-use scenarios there's the convention to rename all Objective-C++ class files to .mm. This helps compilers to distinguish.

So in a project which uses both Objective-C and Objective-C++ you will see:

  • .m files containing Objective-C
  • .mm files containing Objective-C++