安装tinyhttpd遇到的问题

andy@AndyMacBookPro:/usr/local/src/tinyhttpd$ make
gcc -W -Wall -lsocket -lpthread -o httpd httpd.c
httpd.c:437:52: warning: passing 'int *' to parameter of type 'socklen_t *'
      (aka 'unsigned int *') converts between pointers to integer types with
      different sign [-Wpointer-sign]
  if (getsockname(httpd, (struct sockaddr *)&name, &namelen) == -1)
                                                   ^~~~~~~~
/usr/include/sys/socket.h:561:74: note: passing argument to parameter here
int     getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict)
                                                                             ^
httpd.c:491:24: warning: passing 'int *' to parameter of type 'socklen_t *'
      (aka 'unsigned int *') converts between pointers to integer types with
      different sign [-Wpointer-sign]
                       &client_name_len);
                       ^~~~~~~~~~~~~~~~
/usr/include/sys/socket.h:555:69: note: passing argument to parameter here
int     accept(int, struct sockaddr * __restrict, socklen_t * __restrict)
                                                                        ^
httpd.c:495:40: warning: incompatible pointer types passing 'void (int)' to
      parameter of type 'void *(*)(void *)' [-Wincompatible-pointer-types]
 if (pthread_create(&newthread , NULL, accept_request, client_sock) != 0)
                                       ^~~~~~~~~~~~~~
/usr/include/pthread.h:311:11: note: passing argument to parameter here
                void *(*)(void *), void * __restrict);
                        ^
httpd.c:495:56: warning: incompatible integer to pointer conversion passing
      'int' to parameter of type 'void *' [-Wint-conversion]
 if (pthread_create(&newthread , NULL, accept_request, client_sock) != 0)
                                                       ^~~~~~~~~~~
/usr/include/pthread.h:311:39: note: passing argument to parameter here
                void *(*)(void *), void * __restrict);
                                                    ^
4 warnings generated.
ld: library not found for -lsocket
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [httpd] Error 1
andy@AndyMacBookPro:/usr/local/src/tinyhttpd$

关于这个问题,在命令行使用:

xcode-select –install

然后会提示安装:

xcode-select --install

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值