1
我不知道科科什麼問題。當我運行cocos run -p linux時它工作正常。現在當我添加TMXTileMap時,即使是AppDelegate也會出錯。爲什麼?Cocos2dx undefined參考
CMakeFiles/MyGame.dir/Classes/AppDelegate.cpp.o: In function `AppDelegate::applicationDidFinishLaunching()':
/home/developer/Documents/cocos/TileGame/Classes/AppDelegate.cpp:43: undefined reference to `cocos2d::GLViewImpl::createWithRect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cocos2d::Rect, float)'
CMakeFiles/MyGame.dir/Classes/AppDelegate.cpp.o:(.rodata._ZTV11AppDelegate[_ZTV11AppDelegate]+0x60): undefined reference to `cocos2d::Application::openURL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/MyGame.dir/Classes/HelloWorldScene.cpp.o: In function `HelloWorld::init()':
/home/developer/Documents/cocos/TileGame/Classes/HelloWorldScene.cpp:31: undefined reference to `cocos2d::TMXTiledMap::initWithTMXFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/developer/Documents/cocos/TileGame/Classes/HelloWorldScene.cpp:32: undefined reference to `cocos2d::TMXTiledMap::getLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/home/developer/Documents/cocos/TileGame/Classes/HelloWorldScene.cpp:36: undefined reference to `cocos2d::TMXTiledMap::getObjectGroup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/MyGame.dir/Classes/HelloWorldScene.cpp.o:(.rodata._ZTV10HelloWorld[_ZTV10HelloWorld]+0x20): undefined reference to `cocos2d::Layer::getDescription[abi:cxx11]() const'
CMakeFiles/MyGame.dir/Classes/HelloWorldScene.cpp.o:(.rodata._ZTV10HelloWorld[_ZTV10HelloWorld]+0x218): undefined reference to `cocos2d::Node::addChild(cocos2d::Node*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/MyGame.dir/Classes/HelloWorldScene.cpp.o:(.rodata._ZTV10HelloWorld[_ZTV10HelloWorld]+0x228): undefined reference to `cocos2d::Node::getChildByName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/MyGame.dir/Classes/HelloWorldScene.cpp.o:(.rodata._ZTV10HelloWorld[_ZTV10HelloWorld]+0x230): undefined reference to `cocos2d::Node::enumerateChildren(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<bool (cocos2d::Node*)>) const'
CMakeFiles/MyGame.dir/Classes/HelloWorldScene.cpp.o:(.rodata._ZTV10HelloWorld[_ZTV10HelloWorld]+0x288): undefined reference to `cocos2d::Node::removeChildByName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
CMakeFiles/MyGame.dir/Classes/HelloWorldScene.cpp.o:(.rodata._ZTV10HelloWorld[_ZTV10HelloWorld]+0x2c0): undefined reference to `cocos2d::Node::getName[abi:cxx11]() const'
CMakeFiles/MyGame.dir/Classes/HelloWorldScene.cpp.o:(.rodata._ZTV10HelloWorld[_ZTV10HelloWorld]+0x2c8): undefined reference to `cocos2d::Node::setName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/MyGame.dir/Classes/HelloWorldScene.cpp.o:(.rodata._ZTV10HelloWorld[_ZTV10HelloWorld]+0x460): undefined reference to `cocos2d::Node::removeComponent(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
CMakeFiles/MyGame.dir/build.make:173: recipe for target 'bin/MyGame' failed
make[2]: *** [bin/MyGame] Error 1
CMakeFiles/Makefile2:73: recipe for target 'CMakeFiles/MyGame.dir/all' failed
make[1]: *** [CMakeFiles/MyGame.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Error running command, return code: 2.
它看起來像你搞砸了android.manifest文件,並且cocos庫不再是依賴項。 –
嗨。你能提供更多信息嗎?它似乎我所有的項目都不會運行,但新創建的項目將運行 – Snippet