I have an XCode project (Objective-C) to which I’m trying to add a C++ library I’ve coded earlier. As soon as I add a single .cpp or .mm file, the build process will trip up on random things, usually when building the prefix header. The same thing happens when I include .c files. Basically, I can only use .m files in my target. The last error I’ve got was:
SDKpath/public/CoreGraphics.framework/Headers/CGFont.h:53:
error: expected constructor, destructor, or type conversion before ‘;’ token
The code at that line being:
CG_EXTERN CGFontGetGlyphsForUnichars(CGFontRef font, void* chars, CGGlyph* glyphs, int len)
CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
I’m pretty sure that the code isn’t what caused that issue, but I can’t figure out what is wrong with my build settings. If I get rid of that include, then the build process will trip on the first bit of Objective-C code it gets to.
This is my prefix header:
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <IOSurface/IOSurfaceAPI.h>
#import "CGColorUtil.h"
#endif
I’m an idiot. For some reason the return type was missing from the function.