Error “Cast from pointer to smaller type 'int' loses information” in when update Xcode to 5.1 (5B130a)

Error “Cast from pointer to smaller type 'int' loses information” in when update Xcode to 5.1 (5B130a)

I updated Xcode to the newest version (5.1 (5B130a)) to compatible with iOS 7.1. Then I build my project, I get the error “Cast from pointer to smaller type ‘int’ loses information” in file (line 408) when 64-bit simulators (e.g.: iPhone Retina 4-inch 64-bit) is selected.

I’m using cocos2d-x-2.2.2. Before I update Xcode, my project still can build and run normally with all devices.
Here is some piece of code where that error occur:
/cocos2d-x-2.2.2/cocos2dx/platform/ios/ Cast from pointer to smaller type ‘int’ loses information

// Pass the touches to the superview
#pragma mark EAGLView - Touch Delegate

  • (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    if (isKeyboardShown_)
    [self handleTouchesAfterKeyboardShow];

    int ids[IOS_MAX_TOUCHES_COUNT] = {0};
    float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
    float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};

    int i = 0;
    for (UITouch *touch in touches) {
    ids[i] = (int)touch; // error occur here
    xs[i] = [touch locationInView: [touch view]].x * view.contentScaleFactor;;
    ys[i] = [touch locationInView: [touch view]].y * view.contentScaleFactor;;
    cocos2d::CCEGLView::sharedOpenGLView()->handleTouchesBegin(i, ids, xs, ys);

Please advise. it seems only happen after I update xcode to 5.1 and try to run the app on ipad retina 64-bit simulator or my new ipad air (which I presume is running 64 bit too), it works fine on all order devices (non-64 bit).


we have exactly same problem after update to 7.1, also this:

libs/cocos2dx/kazmath/src/neon_matrix_impl.c:64:18: Unknown register name ‘q0’ in asm
cocos2dx/kazmath/src/neon_matrix_impl.c:93:18: Unknown register name ‘q0’ in asm

I must point out that on debug it does build without problem, but on release it shows error mentioned bay harrisonsu and one I wrote above.

Thank you and best regards,


I had to replace

if defined(ARM_NEON)

if defined(_ARM_ARCH_7)
in neon_matrix_impl.c

to fix this problem. I think you can also try this too.

I meet this problem too.
ids[i] = (int)touch; // error occur here => I change this to below.
ids[i] = (uintptr_t)touch;
Then i can continue compiling. Maybe you can try this too.

In the version I’m using the define is:

if defined(ARM_NEON)

Does this mean I should replace with:

if defined(ARMARCH_7)