Linux上Clion编译Cocos2d-x项目

我是在Linux Mint下编译的, 其他发行版本举一反三
用Clion编译Cocos2d-x项目和用cocos命令行是同样的效果```
##准备工作
```bash
./setup.py #按照提示设置好各种环境变量
./download-deps.py; #这步就会安装好所需的东西

cd $COCOS2DX
./build_linux.sh

如果直接 cocos run xxx 出现依赖不满足

Could NOT find xxx

手动安装一大堆lib

sudo apt install libboost-all-dev mesa-common-dev mesa-utils-extra libgl1-mesa-dev  libglapi-mesa glew-utils libglew-dev g++ libglfw3-dev libglew-dev glew-utils libfontconfig1-dev libgtk-3-dev libcurl4-openssl-dev

继续

Linux上Clion编译Cocos2d-x项目_第1张图片
刷新一下cmake

Linux上Clion编译Cocos2d-x项目_第2张图片
compile

如果总是提示找不到glfw3看一下这个 unable-to-locate-package-glfw-on-linux-mint

最后报错

error while loading shared libraries: libfmod.so.6: cannot open shared object file: No such file or directory
这就尴尬了……
解决
https://github.com/cocos2d/cocos2d-x/issues/14961

sudo cp <*COCOS FOLDER LOCATION*>/external/linux-specific/fmod/prebuilt/64-bit/libfmod.so /usr/local/lib/

sudo cp <*COCOS FOLDER LOCATION*>/external/linux-specific/fmod/prebuilt/64-bit/libfmodL.so /usr/local/lib/

sudo cp <*COCOS FOLDER LOCATION*>/external/linux-specific/fmod/include/*.h /usr/local/include/```



![s](http://upload-images.jianshu.io/upload_images/3538120-3251c86ea771b0b5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![记得重命名](http://upload-images.jianshu.io/upload_images/3538120-b39f26c0a72da05b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)



![QAQ](http://upload-images.jianshu.io/upload_images/3538120-ceaa77d6be38aa15.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

你可能感兴趣的:(Linux上Clion编译Cocos2d-x项目)