ios - Duplicate symbol error with GoogleCast.framework -
i started porting android app ios, , hitting major roadblock can't figure out despite scouring many similar questions.
i attempting follow pattern implemented in castvideos sample googlecast api encapsulated in singleton class i've called castmanager. use singleton class, #import "castmanager.h" in appdelegate.m. in castmanager.h, #import <googlecast/googlecast.h> can use classes , protocols part of castmanager's public interface. however, because i'm importing castmanager.h in both castmanager.m , appdelegate.m, linker finding duplicate symbols googlecast framework.
this castmanager.h:
#import <googlecast/googlecast.h> #import <foundation/foundation.h> @interface castmanager : nsobject @property(nonatomic, strong) gckdevicescanner *devicescanner; + (instancetype)sharedcastmanager; @end and corresponding castmanager.m:
#import "castmanager.h" @implementation castmanager + (instancetype)sharedcastmanager { nslog(@"sharedcastmanager"); static castmanager *singleton = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ singleton = [[self alloc] init]; }); return singleton; } - (instancetype)init { nslog(@"init()"); if (self = [super init]) { self.devicescanner = [[gckdevicescanner alloc] init]; } return self; } @end and main part of appdelegate.m:
#import "appdelegate.h" #import "castmanager.h" @implementation appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { castmanager *castmanager = [castmanager sharedcastmanager]; return yes; } however, results in following error linker when attempting build project:
duplicate symbol _kgckdevicecapabilityvideoout in: /users/nate/library/developer/xcode/deriveddata/mycastapp-ezrgxdnlvywpanerezulnarzknno/build/intermediates/mycastapp.build/debug-iphonesimulator/mycastapp.build/objects-normal/x86_64/appdelegate.o /users/nate/library/developer/xcode/deriveddata/mycastapp-ezrgxdnlvywpanerezulnarzknno/build/intermediates/mycastapp.build/debug-iphonesimulator/mycastapp.build/objects-normal/x86_64/castmanager.o ... many similar errors ommitted brevity ... duplicate symbol _kgckdevicecapabilityaudioin in: /users/nate/library/developer/xcode/deriveddata/mycastapp-ezrgxdnlvywpanerezulnarzknno/build/intermediates/mycastapp.build/debug-iphonesimulator/mycastapp.build/objects-normal/x86_64/appdelegate.o /users/nate/projects/mycastapp/googlecast.framework/googlecast(gckdevice.o) ld: 8 duplicate symbols architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) as far can tell, copies pattern defined in castvideos sample, sample compiles fine, , mine doesn't, , i've scoured through both projects trying find different, don't see it. further, don't see wrong doing this, , expect work fine. can't think of other way it, really.
here relevant files castvideos sample comparison:
other questions point solutions don't apply or don't fix it:
- i'm not importing
.mfile on accident. - i don't have duplicate references files in project.
- the "compile sources" section of "build phases" project setting doesn't include duplicates.
- i've added '-objc' linker flag described googlecast api docs, though has same error or without it.
- i've tried deleting delegate data , doing clean before building.
- this xcode 6.3.1 running on os x yosemite 10.10.3 , googlecastsdk-2.6.0 package the sdk documentation page
i have checked in sample project problem @ https://github.com/nshafer/mycastapp
any appreciated!
edit: duplicate related, it's same symbols, answers there didn't help, i'm not using object-c++, rather objective-c. don't have .mm file, .m file.
for me helped switch "no common blocks" compiler setting no:

it pretty seems make sense, setting explained here: what gcc_no_common_blocks used for?
Comments
Post a Comment