lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::GLViewImpl()': /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwSetErrorCallback' lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::initWithRect(std::string const&, cocos2d::Rect, float)': /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwWindowHint' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwWindowHint' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwWindowHint' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwWindowHint' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwWindowHint' lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o):/home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: more undefined references to `glfwWindowHint' follow lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::initWithRect(std::string const&, cocos2d::Rect, float)': /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwCreateWindow' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwMakeContextCurrent' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwSetCursorPosCallback' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwSetScrollCallback' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwSetWindowPosCallback' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwSetFramebufferSizeCallback' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwSetWindowIconifyCallback' lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::initWithFullScreen(std::string const&)': /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwGetPrimaryMonitor' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwGetVideoMode' lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::initWithFullscreen(std::string const&, GLFWvidmode const&, GLFWmonitor*)': /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwWindowHint' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwWindowHint' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwWindowHint' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwWindowHint' lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::end()': /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwSetWindowShouldClose' lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::windowShouldClose()': /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwWindowShouldClose' lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::setCursorVisible(bool)': /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwSetInputMode' /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwSetInputMode' lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::updateFrameSize()': /home/vin/workspace/wechat/cocos2d/cocos/platform/desktop/CCGLViewImpl-desktop.cpp:: undefined reference to `glfwGetFramebufferSize' collect2: error: ld returned exit status make[]: *** [bin/MyGame] Error make[]: *** [CMakeFiles/MyGame.dir/all] Error make: *** [all] Error
解决方案:
just typing "sudo apt-get purge libglfw2"
and then execute the script "cocos2d-x/tools/travis-scripts/install_glfw.sh" and after that, I can build my "hello project" properly.