问题
Any of you guys had errors when building your iOS project after updating to the new Google Cast 2.6.0 framework?
I get the following error: Default initialisation of an object of const type ‘const NSInteger’ (aka ‘const int’). at the following lines in class GCKDevice:
/** Device capability flag for video out. */
GCK_EXPORT const NSInteger kGCKDeviceCapabilityVideoOut;
/** Device capability flag for video in. */
GCK_EXPORT const NSInteger kGCKDeviceCapabilityVideoIn;
/** Device capability flag for audio out. */
GCK_EXPORT const NSInteger kGCKDeviceCapabilityAudioOut;
/** Device capability flag for audio in. */
GCK_EXPORT const NSInteger kGCKDeviceCapabilityAudioIn;
回答1:
There is a bug in this version of the SDK for files compiled under Objective-C++. If you import the classes from a .mm file, there is a missing extern which will trigger a problem. As a workaround, if you can move you code to a regular .m file you should be OK (and you should be able to call out to that as long as you don't expose the GCK headers to the mm).
回答2:
For me it helped to switch the "No Common Blocks" compiler setting to NO:
![](https://i0.wp.com/i.stack.imgur.com/q6hIU.png)
It pretty much seems to make sense, this setting defines how duplicate variable definitions are handled by the compiler. It is explained here: What is GCC_NO_COMMON_BLOCKS used for?
来源:https://stackoverflow.com/questions/29429836/google-cast-2-6-0-errors-when-building-ios-project