centos7 安装 libuv

环境: centos7.2, gcc,g++ version: 4.8.5

yum install -y libuv libuv-devel

demo  hello.c

#include <stdio.h>
#include <stdlib.h>
#include <uv.h>

int main() {
uv_loop_t *loop = malloc(sizeof(uv_loop_t));
uv_loop_init(loop);

printf("Now quitting. ");
uv_run(loop, UV_RUN_DEFAULT);

uv_loop_close(loop);
free(loop);
return 0;
}

编译:

//生成hello.o文件

$gcc -c hello.c -o hello.o

// 链接生成可执行文件

 $gcc hello.c -L/usr/local/lib/ -luv -o hello 

//也可使用如下命令进行链接:

gcc -lpthread -o hello hello.c  -L/usr/local/lib/libuv.a

原文地址:https://www.cnblogs.com/iwana/p/13683758.html