socket.io-client-cpp icon indicating copy to clipboard operation
socket.io-client-cpp copied to clipboard

Could not compiler in Raspberry Pi Codeblocks

Open linuxrd007 opened this issue 3 years ago • 13 comments

I was download from githhub and cmake & make install it. Install process show as follows. NB_Image_20220224_144434

I add <sio_client.h> <sio_message.h> <sio_socket.h> into project common header, compiler failure. show as follows. NB_Image_20220302_142654

I try to add linker show as follows. NB_Image_20220302_143129

And add compiler path NB_Image_20220302_143227

Add linker path, too. NB_Image_20220302_143300

But, there are still can not work!? Please support me how to solve it, thanks.

linuxrd007 avatar Mar 02 '22 08:03 linuxrd007

Hi, can you give me a sample of the file that you are trying to compile?

jmigual avatar Mar 02 '22 20:03 jmigual

Hi Joan, Please see sample code link: https://github.com/linuxrd007/sample.git Thank you.

linuxrd007 avatar Mar 04 '22 05:03 linuxrd007

Hi @linuxrd007 thanks for the sample project. It seems that your project is a C project while the socket.io library is a C++ library. If you want to use this library you'll need to change your project to C++.

jmigual avatar Mar 04 '22 11:03 jmigual

Hi @jmigual, I chose C++ when I start this project at first, but still can not compiler. 截圖 2022-03-04 23 15 18 Should I download release version(v3.1.0) to test again? Thank you.

linuxrd007 avatar Mar 04 '22 15:03 linuxrd007

Hi @linuxrd007 yes download the newest release version as the issue you are having is with missing Boost libraries which were removed in the 3.0.0 release.

jmigual avatar Mar 04 '22 16:03 jmigual

Hi @jmigual, v3.1.0 was include Boost libraries? If not, which is the suggested source code? Thank you.

linuxrd007 avatar Mar 05 '22 03:03 linuxrd007

Hi @linuxrd007,

v3.1.0 does not need the boost libraries. They were removed so you don't need to install them.

jmigual avatar Mar 06 '22 08:03 jmigual

Hi @jmigual, asio/ catch/ rapidjson/ websocketpp/ Are there 4 more libaries need to install by myself, which are the suggested source code? Thank you.

linuxrd007 avatar Mar 08 '22 07:03 linuxrd007

As far as I know these are the only libraries that you need. Also, catch is only needed if you want to test socket.io

jmigual avatar Mar 08 '22 08:03 jmigual

Hi @jmigual, I found the library as follows: asio/ : https://github.com/chriskohlhoff/asio catch/ : https://github.com/catchorg/Catch2 rapidjson/ : https://github.com/Tencent/rapidjson websocketpp/ : https://github.com/zaphoyd/websocketpp Socket.IO/ : https://github.com/socketio/socket.io-client-cpp/releases

re-build source code by "cmake" & "make install". NB_Image_20220308_161312

Create new project for pure C++ in Raspberry Pi, but it still error occur. NB_Image_20220308_164120

new sample please clone: https://github.com/linuxrd007/sample.git The project is pure C++ and only add socket.io source file, but still error occur!? Please support me, thank you.

linuxrd007 avatar Mar 08 '22 09:03 linuxrd007

You should follow the installation without CMake instructions: https://github.com/socketio/socket.io-client-cpp/blob/master/INSTALL.md#without-cmake

Clone the repository as a submodule in your project. The asio library version that we are using is not the latest one.

jmigual avatar Mar 08 '22 10:03 jmigual

Hi @jmigual, Follow the installation without CMake instructions method is work, thank you.

But, it spend a lot of time compiling program, thus use cmake install into OS is more convenient. I try "git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git", again. Create new pure C++ project in CodeBlocks of Raspberry Pi, setting build option as follows. NB_Image_20220309_094714 NB_Image_20220309_094731 NB_Image_20220309_094748

After setting link & lib path but still can not find link library!? NB_Image_20220309_095055

linuxrd007 avatar Mar 09 '22 00:03 linuxrd007

Don't link asio, rapidjson and webpsocketcpp as they are header-only libraries.

jmigual avatar Mar 09 '22 07:03 jmigual