FMParallaxChild.h
typedef struct {
// ...
} FMParallaxSetting;
inline extern FMParallaxSetting FMParallaxSettingMake(CGPoint ratio, CGPoint startPos, CGPoint offset, CGPoint relVel, int zOrder);
inline extern FMParallaxSetting FMParallaxSettingMake(CGPoint ratio, CGPoint startPos, CGPoint offset, CGPoint relVel, int zOrder) {
// ...
}
FMParallax.h
#import "FMParallaxChild.h"
....
MyController.h
#import "FMParallax.h"
....
AppDelegate.m
#import "MyController.h"
....
From this simplified setup I am getting a duplicate symbol linker error:
ld: duplicate symbol _FMParallaxSettingMake in MyController.o and AppDelegate.o
I can’t find any import loops and I only import FMParallaxChild.h in a single place, so what am I doing wrong?
Declare it as
static inlinefor c or objc:or just
inlinefor c++ or objc++:of course, with c++ and objc++, your program will fall back on the One Definition Rule in this case (which is a good default).
The problem as it is, is that it will be exported for each translation it is visible (
#included) in.