Undefined symbols for architecture arm64 in cocos 2d-x 3.10 project

Hello,

I’m working on an (five years) old cocos2dx project and I’m getting the following errors when debugging for AppleTV
Xcode 11 / tvOS 13 / cocos 2d-x 3.10

Apple Mach-O Linker (ld) Error

Undefined symbols for architecture arm64:
  "cocos2d::TextureCube::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      cocos2d::CameraBackgroundSkyBoxBrush::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libcocos2d tvOS.a(CCCameraBackgroundBrush.o)
  "cocos2d::TextureCube::setTexParameters(cocos2d::Texture2D::_TexParams const&)", referenced from:
      cocos2d::CameraBackgroundSkyBoxBrush::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libcocos2d tvOS.a(CCCameraBackgroundBrush.o)
  "RatingLayer::create()", referenced from:
      ParallaxApplication::createAndShowRatingLayer() in ParallaxApplication.o
  "RatingLayer::acquireBackdrop()", referenced from:
      ParallaxApplication::createAndShowRatingLayer() in ParallaxApplication.o
  "RatingLayer::setReturnCallback(std::__1::function<void ()>)", referenced from:
      ParallaxApplication::createAndShowRatingLayer() in ParallaxApplication.o
  "RatingLayer::hide()", referenced from:
      ParallaxApplication::ratingLayerCallback() in ParallaxApplication.o
  "RatingLayer::show()", referenced from:
      ParallaxApplication::createAndShowRatingLayer() in ParallaxApplication.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The code runs fine on iOS and macOS. This problem appears only on tvOS.
I’m not an experience coder but I know that the guys who build this code were. I’ve been stuck on this for the last two days and I feel I’m missing something stupid.
Any guidance is very appreciated.
Thanks in advance

Eureka!

After 2 days banging my head against the wall I’ve found out what was wrong.

Apparently the errors:
Apple Mach-O Linker (ld) Error / Undefined symbols for architecture
are shown when, though a file is present in you project, it is not present in Compile Sources list and/or Headers list

Due to some kind of Voodoo magic that I can not explain the files some files went missing from this list and cause these errors.

Remember: When getting this error, always check project.xcodeproj/targets/Build Phases/Compile Sources and project.xcodeproj/targets/Build Phases/Headers for the corresponding files

do the same with cocos2d_libs if you are getting this error in cocos2d class/method

Hope this helps other developers

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.