I'm using the C++ socket.io library in my C++ project, and I'm unable to include the required header files in my projects header file.
But when I include the required header files in my CPP file, I am successfully able to include the required header files.
Steps taken to utilize the library:
- Compile the C++ websocketpp, openssl, boost library, and prepare the JSON library.
- Link against the *.lib files in my VS2015 project.
- Include the header files location in the C++ additional include dependencies folder.
- Include the *.lib files location in the Linker include dependencies folder.
- Include the three header files in my CPP file.
- Build. Yay! It works!
- Attempt to encapsulate the libraries functionality into my own class/object.
- Attempt to include the three libraries header files in my header file. Notice a plethora of compilation errors about initializing.
Header File Import
#include <sio_message.h>
#include <sio_socket.h>
#include <sio_client.h>
Error when including header files within header file:
Severity Code Description Project File Line Suppression State
Error C2440 'initializing': cannot convert from 'nullptr' to 'const int &' c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2838 'function<void __cdecl(sio::message::list const &)>': illegal qualified name in member declaration c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2838 'function<void __cdecl(sio::message::list const &)>': illegal qualified name in member declaration c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2440 'initializing': cannot convert from 'nullptr' to 'const int &' c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2838 'list': illegal qualified name in member declaration c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2838 'list': illegal qualified name in member declaration c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2439 'sio::socket::ack': member could not be initialized c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2439 'sio::socket::ack': member could not be initialized c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2439 'sio::socket::msglist': member could not be initialized c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2439 'sio::socket::msglist': member could not be initialized c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2530 'sio::socket::name': references must be initialized c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 96
Error C2530 'sio::socket::name': references must be initialized c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 96
Error C2838 'string': illegal qualified name in member declaration c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2838 'string': illegal qualified name in member declaration c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2059 syntax error: ')' c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2059 syntax error: ')' c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2143 syntax error: missing ')' before 'const' c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2143 syntax error: missing ')' before 'const' c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2143 syntax error: missing ';' before 'const' c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Error C2143 syntax error: missing ';' before 'const' c:\root\src\socket.io-client-cpp\build\include\sio_socket.h 75
Possible Problems:
- Shared Namespace? Maybe I'm propagating an incorrect namespace?
- Circular Dependencies? Maybe I'm causing a circular dependency by including the header files in my class, and one of the other header files are including that same file.