Reputation: 37
Consider the followng situation:
MacFont.h
struct MacFont : Font
{
// ...
NSFont* font;
};
MacFont will be implemented in MacFont.mm
FontEngine.cpp:
#if defined(OS_MAC)
#include "MacFont.h"
#elif
// ...
#endif
//...
In order to make it compiling, I should rename FontEngine.cpp to FontEngine.mm but I'm not allowed to.
So what now?
Upvotes: 1
Views: 613
Reputation: 20236
If you cannot change the filename, don't fret. Consult your compiler manual for an option to force the filetype, and tell the compiler that this file, regardless of extension, is an Objective-C++ file.
Upvotes: 3
Reputation: 32720
You can only compile ObjC things (e.g. NSFont) into a ObjC file (ir .m or .mm) so you can only do the rename.
You could create another C++ object inheriting from the C++ object in FontEngine.cpp and then that C++ object can have implementation including Obj C parts.
Upvotes: 0