0

I'm pretty new to WebSocket in C++ and trying to use websocketpp library from Github https://github.com/zaphoyd/websocketpp. Since as I said I'm new I still not able to figure out how to use it. I'm trying to run some sample WebSocket program from the same sample repo.

Can someone please tell me in detail how to use it. I have cloned the repo in my local system and compiling this sample file

#include <iostream>

#include <websocketpp/config/asio_no_tls.hpp>
#include <websocketpp/server.hpp>

typedef websocketpp::server<websocketpp::config::asio> server;

void on_message(websocketpp::connection_hdl hdl, server::message_ptr msg)
{
    std::cout << msg->get_payload() << std::endl;
}

int main()
{
    server print_server;

    print_server.set_message_handler(&on_message);

    print_server.init_asio();
    print_server.listen(9002);
    print_server.start_accept();

    print_server.run();
}

throw the error fatal error: websocketpp/config/asio_no_tls.hpp: No such file or directory #include <websocketpp/config/asio_no_tls.hpp> moreover seraching the error button it shows includePath error.

Help me out. Thanks alot in advance.

Raman
  • 27
  • 4

1 Answers1

0

I guess you get this error because you didn't add this header file to include directories and library directories parts of your project.

Right click on project and select Properties.

Common Properties => VC++ Directories

Include Directories => add the directory where you installed websocketpp library.

Library Directories => add the directory where you built websocketpp library.

east1000
  • 1,240
  • 1
  • 10
  • 30
  • I'm using VS code instead of VS studio so no project option. Can u provide some other solution. – Raman May 03 '21 at 11:10
  • maybe this links can help you https://stackoverflow.com/questions/37522462 https://stackoverflow.com/questions/53973777 – east1000 May 03 '21 at 11:18