einverne
einverne

Reputation: 6682

cocos2d-x Undefined symbols for architecture x86_64 when porting iOS app in Xcode?

I am developing a cocos2d-x project on Xcode. I create a Scene and I met this error:

Undefined symbols for architecture x86_64:
  "MainScene::scene()", referenced from:
      Splash::finishSplash(float) in Splash.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have searched for quite a while and see a lot of solutions. But I am still confused about the error. Sometimes I met the x86_64 error and sometimes met the i386 error. I am new to iOS develop. So how can I solve the problem?

I have tried following, but errors still come out:

  1. remove item i386 and arm64 in Valid Architectures
  2. add all path in Header Search Paths
  3. checked Linked Frameworks and libraries

I am using cocos2d-x 2.2.6 cpp. Xcode Version 6.3.2 (6D2105). I used the python script to create this iOS project.

Upvotes: 1

Views: 3400

Answers (2)

Davinder Singh
Davinder Singh

Reputation: 13

This is a 64-bit error.
Cocos2d-x2.2.6 has 64-bit support so you should not remove arm64 from architecture.

  1. Make sure you are using Cocos2dx-2.2.6.
  2. Set YES to "Build Active architecture only".
  3. Remove Unused Lib. references i.e proj.win32, proj.linux, proj.nacl etc.

Or please submit more code/logs so i can help you better.

Upvotes: 0

Makalele
Makalele

Reputation: 7521

I had similar problem. I use following configuration (on cocos2d-x 3.x but it should be the same on 2.x):

On root project:

Build Active Architecture Only - Yes (Debug), No (Release). Valid Architectures: armv7, armv7s, i386, x86_64, arm64.

On cocos2d_libs project:

Build Active Architecture No. Valid Architectures: armv7, armv7s, i386, x86_64, arm64.

You should also update to the latest Xcode (it may be not soon possible to send an app on Xcode 6.x to the app store) and cocos2d-x (it's easier than 2.x).

Upvotes: 1

Related Questions