semantic error redefinition of cccontentscalefactor with a different type

semantic error redefinition of cccontentscalefactor with a different type  using -'ios,cocos2d-iphone'

i have developed a new game and it is running perfectly fine on my real ios devices and even on simulators but when i decided to submit it to AppStore it is giving error on this line.

extern CGFloat  __ccContentScaleFactor;

and error is

cocos2d/Platforms/iOS/CCDirectorIOS.h:102:16: Redefinition of '__ccContentScaleFactor' with a different type: 'CGFloat' (aka 'double') vs 'float'

can anyone please help me with this issue i just update xcode to 5.1. thanks

asked Sep 16, 2015 by shegokar.anjeet
0 votes

2 Answers

0 votes

Important Update:

Cocos2D v2.2 with 64-Bit fixes has been released.

I strongly suggest every cocos2d v2.x developer to upgrade to this version rather than applying the quick fix below. There are many 64-Bit compatibility issues lurking in cocos2d v2.0 and v2.1, which may rear their ugly head in weird bugs, visual glitches or more compile errors - depending on the app.

Beginning in February 2015 Apple will only accept new apps and app upgrades which include 64-Bit binaries. So it's highly recommended to get your code and cocos2d to a proper working state on 64-bit devices.

Quick & dirty fix only for this particular issue:

Edit the line the compiler complains about, change CGFloat to float so that it reads:

extern float  __ccContentScaleFactor;

However this indicates that xcode is building the arm64 slice. For cocos2d-iphone v2.x it is best to disable/remove arm64 from supported architectures because Cocos2D v2.1 and earlier are not fully compatible with 64bit devices!

There can be weird bugs and side-effects when running a Cocos2D v2.1 or earlier app compiled as 64-bit code and running on a 64-Bit device (iPhone 5S and newer). These issues may not occur on the iOS Simulator.

answered Sep 16, 2015 by girisha
0 votes

As now developers are finding new solution for this problem . because apple says ARM64 will be compulsory from February, 2015 . so you can fix this by just changing:




where every you get this problem in coco2d project. thanks

answered Sep 16, 2015 by mcasudhir