Search code examples
iphoneiosxcodebuildcocos2d-x

Cocos2d-x project's 2nd rebuild onwards gives an error 'Xcode cannor run using selected device'


Fresh cocos2d-x project build using Xcode runs normally on iOS simulator/device, but after making changes to cpp source files, rebuild fails with error-

Xcode cannor run using selected device. Choose a destination with a supported architecture in order to run on this device.

The only way to make it work is delete build binaries (i.e. delete XCode>Derived Data folder), and take fresh build after restarting Xcode.

Can someone please help me resolve this issue?

Additional Details:

  1. This error is related to mismatching device architecture and armv6 armv7 flags. But first build works fine, and stops working after second build onwards, that means this is not a possible issue.
  2. If the project is not using cocos2d-x (i.e. plain Objective-C project), then there is no such error after second build.
  3. Compiler selected: Apple LLVM Compiler 4.2

Thanks in advance!


Solution

  • Following my comment you should make sure you use the latest templates for creating cocos2d projects. Some templates will only work for a specific Xcode version so make sure you use the right templates for your xcode version (There are some for xcode 3.x and others for xcode 4.x)