Phil
Phil

Reputation: 50396

How to use uWebsockets from Visual Studio C++?

uWebSockets https://github.com/uNetworking/uWebSockets

How to use this from Visual Studio C++ ? I wish to implement a simple websocket server. I don't want to use Makefile, wish to use normal visual studio project build.

Upvotes: 3

Views: 4917

Answers (2)

Дима
Дима

Reputation: 11

  1. If visual studio gives 500+ errors when #include <uwebsockets/App.h>, then connect c++ 20.
  2. If you are building an exe file, then write it at the beginning of the code. #pragma comment(lib, "uSockets.lib") #pragma comment(lib, "uv.lib") #pragma comment(lib, "zlib.lib")
  3. Good luck!

Upvotes: 1

Phil
Phil

Reputation: 50396

This is how to use uWebsockets from Visual C++ IDE project, step by step:

  1. Install Vcpkg https://github.com/microsoft/vcpkg
    then command line the following
  2. set VCPKG_DEFAULT_TRIPLET=x64-windows
  3. vcpkg install uwebsockets

At this point there is then a folder vcpkg\installed\x64-windows which contains the header files and library files and dlls (if you need the dlls).

In your Visual C++ project properties set the include directory and lib directory in the VC Directories.

Then #include <uwebsockets/App.h> and paste code from uwebsockets.

Upvotes: 3

Related Questions