【发布时间】:2015-02-05 22:55:14
【问题描述】:
我刚开始使用 Cocos2d-x c++(版本 3.4),我正在尝试为 Mac 构建一个简单的游戏,但是当我在 AppDelegate.cpp 中更改此行时
auto scene = HelloWorld::createScene();
到我的自定义场景
auto scene = KeyboardScene::createScene();
我收到此链接器错误:
Undefined symbols for architecture x86_64:
"KeyboardScene::createScene()", referenced from:
AppDelegate::applicationDidFinishLaunching() in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation).
我不知道我在这里缺少什么,感谢您的帮助,谢谢。
如果要查看自定义类源码访问:
【问题讨论】:
-
您是否在 AppDelegate 中包含
KeyboardScene.h?您在 pastebin 中有重复的代码,这可能是相关的。 -
不是
#include问题,因为代码可以编译,但没有链接。确保您为 x86_64(而不是 IOS arm)链接到正确的.dynlib
标签: c++ macos linker cocos2d-x