Include a library

Include a library


I want to use websocketpp library in my project and i don’t exactly know how can i include it. I have copied it’s files to external/websocketpp and added the following line to my CMakeFiles.txt: include_directories but when compiling for android it doens’t work, it just says that the file i tried to include doesn’t exist. Thank you for your help.


I think you should show more of what you did. Also, I think websockets is part of the coco2d-x build process anyway. You should just be able to include it and use it where you need it. Perhaps with CMake something is different though.


First, I would not recommend using websocketpp with cocos2dx. Cocos2dx have it own websocket, which lay under cocos2d::network namespace. Cocos2dx team have integrate websocket with libwebsocket dedicate to support difference platforms and SSL connection. Second, Websocketpp library depends on boost asio, so if you intent to integrate with Websocketpp you should also include boost asio library. These work can be really handy if you have small scale of development team. Another option of websocketpp is by using its experimental branch which is header-only library. I haven’t try that branch on cocos2dx, just thinks that would be an option of websocketpp. As my project, I chose cocos2dx’s websocket for my client and communicate with my server which integrate with websocketpp and boost asio.