Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Semantic error: Redefinition of '__ccContentScaleFactor' with a different type" in Cocos2D v2

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

like image 804
user2966615 Avatar asked Mar 11 '14 20:03

user2966615


2 Answers

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.

like image 81
LearnCocos2D Avatar answered Nov 15 '22 04:11

LearnCocos2D


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:

   CGFloat

to

    float

where every you get this problem in coco2d project. thanks

like image 41
Imran Ahmed Avatar answered Nov 15 '22 04:11

Imran Ahmed