Google Cast 2.6.0 errors when building iOS project

蹲街弑〆低调 提交于 2020-01-16 08:04:09

问题


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:

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!