Hack Forums
[C] Unresolved external symbol - Boost [ Socket-io ] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] Unresolved external symbol - Boost [ Socket-io ] (/showthread.php?tid=6061908)



Unresolved external symbol - Boost [ Socket-io ] - maype - Mar 31, 2020

Hi guys,

The past 2 days, I have tried to make a console application that connects to a Socket-io Back-End. I'm not experienced in c++ and configuring external dependencies.

The errors I get:

Code
Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK1120    2 unresolved externals    ConsoleSocketIO    ...\x64\Debug\ConsoleSocketIO.exe    1    
Error (active)    E1097    unknown attribute "no_init_all"    ConsoleSocketIO    C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winnt.h    3886    
Error    LNK2001    unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)    ... \sio_client_impl.obj    1    
Error    LNK2001    unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)    ... \sio_socket.obj    1    
Error    LNK2019    unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat@system@boost@@YAXXZ)    ... \sio_client.obj    1    
Error    LNK2001    unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)    ... \sio_client_impl.obj    1    
Error    LNK2001    unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)    ... \sio_socket.obj    1    
Error    LNK2019    unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "public: __cdecl boost::system::error_code::error_code(void)" (??0error_code@system@boost@@QEAA@XZ)    ... \sio_client.obj    1

I have search for hours on google, on some says :

- The error came from the fact that im trying to compile my application in 64 bit and Boost library is in 32 bits.
- I need to put extra defined constant in the header of my files, in order to skip these kind of error.

Im Using:

- Boost 1.55.0:
https://www.boost.org/users/history/version_1_55_0.html

- RapidJson 1.1.0:
https://github.com/Tencent/rapidjson/releases

- Websocketpp 0.8.1:
https://github.com/zaphoyd/websocketpp/releases

- Visual Studio 2019
- C++14
- Windows 10

I have included the dependencies via VC++ Directories.

Im really lost on this. Can someone please give me hints, on help on this ? I have posted the solution on GitHub which you guys can download.

GitHub Source:
https://github.com/isaelblais/socket-io-console.git

Thanks in advance
Maype


RE: Unresolved external symbol - Boost [ Socket-io ] - saltycracker - Mar 31, 2020

According to this link(from your link) you can download 64 bit binaries.

https://sourceforge.net/projects/boost/files/boost-binaries/1.55.0/

Why are you downloading an old Boost version?


RE: Unresolved external symbol - Boost [ Socket-io ] - maype - Mar 31, 2020

Good questions... I Have tried with version 1.66.0 in 64 bit and it still does not work. I am using old version of boost because it the version required by the example I am using thats requires version 1.55.0 minimum.


RE: Unresolved external symbol - Boost [ Socket-io ] - Mysticism - Mar 31, 2020

I have tried using websocketpp but then I stumbled upon across this:
https://github.com/machinezone/IXWebSocket

I very much prefer it and it because the code is cleaner and the library has no dependencies. Maybe you shalt try that library out.


RE: Unresolved external symbol - Boost [ Socket-io ] - saltycracker - Mar 31, 2020

(Mar 31, 2020 11:51 AM)maype Wrote:  Good questions... I Have tried with version 1.66.0 in 64 bit and it still does not work. I am using old version of boost because it the version required by the example I am using thats requires version 1.55.0 minimum.

If its a problem with word size, then compile it as a 32bit program. C/C++ compilers are very accommodating.

I would try a C++ program with a simple Boost library and see if you can get that to compile. If that compiles then I would try adding the others.

Node: I would memorize this link -> https://www.boost.org/doc/libs/1_72_0/more/getting_started/windows.html

From that page
Quote:Most Boost libraries are header-only: they consist entirely of header files containing templates and inline functions, and require no separately-compiled library binaries or special treatment when linking.