当前位置:网站首页>Installation and operation of libuv
Installation and operation of libuv
2022-06-24 12:15:00 【ufgnix0802】
Libuv Installation and operation of
Libuv Link to the official website of :http://libuv.org/
GitHub Download link :https://github.com/libuv/libuv
CMake Download link :https://cmake.org/download/
The following demo uses VS2022
Download and install
Because the demonstration platform is Windows platform , That is to say CMake Compiled into visual studio Project to compile and run .
After downloading Libuv The directory structure of the framework is as follows :

Then , Use CMake Generate visual studio project .( open CMake) as follows :


The following information can be installed by default .

There is no need to uncheck the following , stay BUILD_TESTING and LIBUV_BUILD_TESTS There are the most basic modules in , For learning ( That is, if you have mastered Libuv frame , May cancel BUILD_TESTING and LIBUV_BUILD_TESTS Checked by ). Finally, click... Again Configure, Then click Generate. as follows :

Final , You can click on the Open Project Open the project ( But we need to pay attention : If the computer has more than vs2022, There are other versions , May be opened in another version , It is better to find it directly build In the file directory sln file , Use the right mouse button vs2022 open )

Run using
Use vs2022 Open the interface as follows :

Next is the key to project configuration , Please read and pay attention to .( The content is from the practice of bloggers , For reference only )
function uv_run_tests_a project ( Generate lib file )
TIPS: You can also try to run directly here uv_a Project generation uv_a.lib file ( Generated lib Same file ).
Right click to run uv_run_tests_a project , as follows :


The following results appear , Indicates successful operation .

Where to open the file , We will find that there is more than exe file , And by what we need lib file , as follows :

Next, create an empty project under the current solution , as follows :




First , Create a new one .c file , as follows :


And then right-click TestDemo01 project , The properties are configured with the following information :

TIPS: How to configure the output directory and intermediate directory of the project , Please refer to the following links , I'm just going to elaborate here :https://ufgnix0802.blog.csdn.net/article/details/121366990
The output directory :$(SolutionDir)\$(ProjectName)\bin/$(Platform)\$(Configuration)
Intermediate Directory :$(SolutionDir)\$(ProjectName)\temp/$(Platform)\$(Configuration)
Then , Configure the following information :

TIPS:D:\libuv\include The included libraries must be imported , Of course, the same configuration principle as the output directory and the intermediate directory can also be used for the path ( Bloggers do not demonstrate here ).
There are also items that need to be configured , as follows :


The contents to be added are :
iphlpapi.lib
userenv.lib
psapi.lib
ws2_32.lib
libs\uv_a.lib

TIPS: Note after confirmation , Be sure to click apply , Same as above .
among , Last item libs\uv_a.lib, We need to use it until we run uv_run_tests_a Generated by the project lib file , Generate a... Under the current project libs Folder , Put the following file .


Finally, we need to introduce task.h Header file into the current project , as follows ( The document can be obtained from libuv/test Look in the directory ):

Copy to TestDemo01 In the project , as follows ( And will task.h Added to the TestDemo01 project ):


Running practice
take libuv/test In the catalog echo-server.c Copy the contents of the file to main.c in , as follows :


Last in main.c In the definition of main function , The contents are as follows :
int main()
{
run_helper_tcp4_echo_server();// Call mode one , Call macro function
// Call mode 2 , Copy the macro function code directly
/* loop = uv_default_loop(); if (tcp4_echo_start(TEST_PORT)) return 1; notify_parent_process(); uv_run(loop, UV_RUN_DEFAULT); */
return 0;
}
Set the project to start project , The operation results are as follows :

The generated file information is as follows :

Here's how to use sokit The effect of the client terminal simulated by the tool :

边栏推荐
- Insurance app aging service evaluation analysis 2022 issue 06
- 深度学习~11+高分疾病相关miRNA研究新视角
- 保险APP适老化服务评测分析2022第06期
- Google ranging for PHP wechat development
- Is it safe to apply for new bonds to open an account
- Clickhouse deployment and basic usage 1
- Group planning - General Review
- New progress in the construction of meituan's Flink based real-time data warehouse platform
- Variable parameter template implements max (accepts multiple parameters, two implementation methods)
- Fizz gateway secondary development integration tutorial
猜你喜欢

How is the e-commerce red envelope realized? For interview (typical high concurrency)

Group counting_ Structure and workflow of CPU

Install Kali on the U disk and persist it

Libuv的安装及运行使用

美团基于 Flink 的实时数仓平台建设新进展

@Requestbody annotation

Insurance app aging service evaluation analysis 2022 issue 06

我真傻,招了一堆只会“谷歌”的程序员!

How to develop hospital information system (his) with SMS notification and voice function

Qt: 判断字符串是否为数字格式
随机推荐
11+! Methylation modification patterns based on m6A regulatory factors in colon cancer are characterized by different tumor microenvironment immune spectra
I'm in Shenzhen. Where can I open an account? Is it safe to open an account online now?
The latest hot spot: the use of copper death related genes for tumor prognosis typing!
u盘安装kali并且持久化
Basic path test of software test on the function of the previous day
Why does the virtual machine Ping the host but not the virtual machine
Turn 2D photos into 3D models to see NVIDIA's new AI "magic"!
[live review] battle code pioneer phase 7: how third-party application developers contribute to open source
最新热点:使用铜死亡相关基因进行肿瘤预后分型!
Group counting_ Structure and workflow of CPU
程序员大部分时间不是写代码,而是。。。
【Go语言刷题篇】Go从0到入门4:切片的高级用法、初级复习与Map入门学习
Google ranging for PHP wechat development
《opencv学习笔记》-- 矩阵归一化 normalize()函数
怎样打新债具体操作 开户是安全的吗
工具及方法 - 在Source Insight中使用代码格式化工具
《opencv学习笔记》-- 感兴趣区域(ROI)、图像混合
Is GF Securities reliable? Is it safe to open a securities account?
Why are some old SEO methods still effective?
Audio knowledge (III) -- MFCCs code implementation