我不知道cocos有什么问题。当我运行cocos run -p linux时,它正在工作。现在当我添加TMXTileMap时,即使AppDelegate也出现了问题。为什么呢?
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.
答案 0 :(得分:0)
我是傻瓜。我正在使用Fedora 22并升级到23,之后在我的cocos项目中一切都地狱。我必须删除当前项目下的linux-build文件夹并再次编译