➜ http-server git:(master) mkdir build && cd build && cmake .. && make
-- The C compiler identification is AppleClang 6.0.0.6000051
-- The CXX compiler identification is AppleClang 6.0.0.6000051
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sang/workspace/github/http-server/build
Scanning dependencies of target http-server
[ 33%] Building C object CMakeFiles/http-server.dir/server.c.o
/Users/sang/workspace/github/http-server/server.c:128:58: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Write error: %s: %s\n", uv_err_name(status), uv_strerror(status));
^~~~~~
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:140:62: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "File read error: %s: %s\n", uv_err_name(r), uv_strerror(r));
^
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:182:56: error: use of undeclared identifier 'errno'
fprintf(stderr, "Allocate error: %s\n", strerror(errno));
^
/Users/sang/workspace/github/http-server/server.c:233:54: error: use of undeclared identifier 'errno'
fprintf(stderr, "Allocate error: %s\n", strerror(errno));
^
/Users/sang/workspace/github/http-server/server.c:239:57: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Write error %s: %s\n", uv_err_name(r), uv_strerror(r));
^
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:250:62: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "File read error: %s: %s\n", uv_err_name(result), uv_strerror(result));
^~~~~~
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:276:57: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Open error: %s: %s\n", uv_err_name(result), uv_strerror(result));
^~~~~~
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:285:57: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Stat error: %s: %s\n", uv_err_name(r), uv_strerror(r));
^
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:342:7: warning: implicit declaration of function 'uv_try_write' is invalid in C99 [-Wimplicit-function-declaration]
r = uv_try_write((uv_stream_t_) request->handle, &buf, 1);
^
/Users/sang/workspace/github/http-server/server.c:380:54: error: use of undeclared identifier 'errno'
fprintf(stderr, "Allocate error: %s\n", strerror(errno));
^
/Users/sang/workspace/github/http-server/server.c:386:57: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Open error: %s: %s\n", uv_err_name(r), uv_strerror(r));
^
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char_ uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:399:60: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Connect error: %s: %s\n", uv_err_name(status), uv_strerror(status));
^~~~~~
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:405:54: error: use of undeclared identifier 'errno'
fprintf(stderr, "Allocate error: %s\n", strerror(errno));
^
/Users/sang/workspace/github/http-server/server.c:411:68: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Socket creation error: %s: %s\n", uv_err_name(r), uv_strerror(r));
^
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:417:59: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Accept error: %s: %s\n", uv_err_name(r), uv_strerror(r));
^
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:423:57: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Flag error: %s: %s\n", uv_err_name(r), uv_strerror(r));
^
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:427:29: warning: incompatible pointer types passing 'void (uv_handle_t , size_t, uv_buf_t *)' to parameter of type 'uv_alloc_cb'
(aka 'uv_buf_t ()(uv_handle_t , size_t)') [-Wincompatible-pointer-types]
r = uv_read_start(stream, on_alloc, on_read);
^~~~~~~~
/usr/local/include/uv.h:593:55: note: passing argument to parameter 'alloc_cb' here
UV_EXTERN int uv_read_start(uv_stream_t, uv_alloc_cb alloc_cb,
^
/Users/sang/workspace/github/http-server/server.c:427:39: warning: incompatible pointer types passing 'void (uv_stream_t , ssize_t, const uv_buf_t *)' to parameter of type
'uv_read_cb' (aka 'void ()(uv_stream_t , ssize_t, uv_buf_t)') [-Wincompatible-pointer-types]
r = uv_read_start(stream, on_alloc, on_read);
^~~~~~~
/usr/local/include/uv.h:594:16: note: passing argument to parameter 'read_cb' here
uv_read_cb read_cb);
^
/Users/sang/workspace/github/http-server/server.c:429:57: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Read error: %s: %s\n", uv_err_name(r), uv_strerror(r));
^
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:497:33: error: too many arguments to function call, expected 2, have 3
r = uv_ip4_addr(ipaddr, port, &addr);
~~~~~~~~~~~ ^~~~~
/usr/local/include/uv.h:1794:1: note: 'uv_ip4_addr' declared here
UV_EXTERN struct sockaddr_in uv_ip4_addr(const char* ip, int port);
^
/usr/local/include/uv.h:43:20: note: expanded from macro 'UV_EXTERN'
define UV_EXTERN attribute((visibility("default")))
/Users/sang/workspace/github/http-server/server.c:499:60: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Address error: %s: %s\n", uv_err_name(r), uv_strerror(r));
^
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
/Users/sang/workspace/github/http-server/server.c:508:68: error: passing 'int' to parameter of incompatible type 'uv_err_t' (aka 'struct uv_err_s')
fprintf(stderr, "Socket creation error: %s: %s\n", uv_err_name(r), uv_strerror(r));
^
/usr/local/include/uv.h:426:44: note: passing argument to parameter 'err' here
UV_EXTERN const char* uv_err_name(uv_err_t err);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
make[2]: *** [CMakeFiles/http-server.dir/server.c.o] Error 1
make[1]: *** [CMakeFiles/http-server.dir/all] Error 2
make: *** [all] Error 2
➜ build git:(master) ✗