uWebSockets use of (a): compile and use uSockets of (a)

                          uSockets compile and use (a)

Reference website:

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

uSockets Project Address: https://github.com/uNetworking/uSockets

I. Summary

    Prior to useful work had websocket, so recently done some research-related open source projects, it is said uWebSockets this great library, wanted to look at. Enlightened, a look surprised ah, the Internet-related information pitiful, I think I might want to tragedy.

    Man of few words said, according to the official website uWebSockets introduction, uWebSockets use to rely uSockets, this event is a network library, so first we need to look uSockets. Use uSockets There are two ways, one is the direct use uSockets source, one is compiled uSockets into a dynamic / static library.

Second, the use of new construction directly uSockets source

     In the example here win10 with vs2017. First downloaded from the project website uSockets project, a project under the src folder is the source. I am here to create a common folder, the file src renamed uSockets and into common folder. In addition uSockets on the win with libuv built, so in common also added a header file and its associated libuv static library. If the compiler is not clear libuv, please refer to my other blog post https://blog.csdn.net/wangdamingll/article/details/101619464

1, a new project

Create a new project, the use of available uSockets / examples / echo_server.c, here I changed echo_server.cpp, the following items are property settings

<1> Project Settings

1) VC ++ directory -> directory containing the header file and include it in uSockets libuv

2) VC ++ directory -> library catalog, the static library that contains the path libuv come

3) C / C ++ -> General -> SDL checked, selecting whether to remove the error pointer uninitialized

4) C / C ++ -> Preprocessor, add LIBUS_NO_SSL, remove ssl function, depending on the project requirements

5) C / C ++ -> precompiled headers, choose not to use precompiled headers

6) Linker -> Input -> Additional Dependencies added libuv.lib Iphlpapi.lib psapi.lib userenv.lib

6) Linker -> Input -> Ignore specific default library, add LIBCMTD

<2> add source files in the project

Right-click on each header and source files -> Add Existing Item, all the files under the common library uSockets under added to project

<3> Click to compile and run

 

Third, the new construction using uSockets static library

    uSockets project web site will project downloaded from, you will find that in fact is already using the dynamic library engineering vs build, but if you open generated by vs, then, will prompt windows SDK there is a problem, right-click the solution -> re Solutions -> selected windows SDK, then again generated, will open a series of reported errors .h, windows SDK should be the question, so I'm here contains source code under src, their new engineering building uSockets vs static library static library

1, New vs 2017 uSockets static library project

Create a static library project, common files and the same step two.

<1> Project Settings

1) VC ++ directory -> directory containing the header file and include it in uSockets libuv

2) VC ++ directory -> library catalog, the static library that contains the path libuv come

3) C / C ++ -> General -> SDL checked, selecting whether to remove the error pointer uninitialized

4) C / C ++ -> Preprocessor, add LIBUS_NO_SSL, remove ssl function, depending on the project requirements

5) C / C ++ -> precompiled headers, choose not to use precompiled headers

<2> add source files in the project

Right-click on each header and source files -> Add Existing Item, all the files under the common library uSockets under added to project

<3> Build Solution

Click to build the solution, it will generate .lib static libraries, and the uSockets's internal folders and libusockets.h extracted as uSockets static library header files can be

 

Published 155 original articles · won praise 15 · views 160 000 +

Guess you like

Origin blog.csdn.net/wangdamingll/article/details/102571887