gpt4 book ai didi

tcp - 错误 : ‘TCP_NODELAY’ was not declared in this scope

转载 作者:可可西里 更新时间:2023-11-01 02:50:30 25 4
gpt4 key购买 nike

我正在尝试在 Ubuntu 16.04 中编译 ChatScipt v7.55。但是当我使用 make server 命令时,我得到了这个错误:

evserver.cpp: In function ‘int settcpnodelay(int)’:
evserver.cpp:263:40: error: ‘TCP_NODELAY’ was not declared in this scope
return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*) &on, sizeof(on));
^
Makefile:110: recipe for target 'evserver.o' failed
make: *** [evserver.o] Error 1

这是命令的完整结果:

************ LINUX VERSION ************
g++ -c -std=c++11 -Wall -funsigned-char -Wno-write-strings -Wno-char-subscripts -Wno-strict-aliasing -DLOCKUSERFILE=1 -DEVSERVER=1 -DEVSERVER_FORK=1 -DDISCARDPOSTGRES=1 -DDISCARDMONGO=1 -DDISCARDMYSQL=1 -Ievserver evserver.cpp -o evserver.o
evserver.cpp: In function ‘int settcpnodelay(int)’:
evserver.cpp:263:40: error: ‘TCP_NODELAY’ was not declared in this scope
return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*) &on, sizeof(on));
^
Makefile:110: recipe for target 'evserver.o' failed
make: *** [evserver.o] Error 1

问题是什么,我该如何解决?

最佳答案

我通过添加 #include <netinet/tcp.h> 解决了这个问题在 evserver.cpp 的上方文件

关于tcp - 错误 : ‘TCP_NODELAY’ was not declared in this scope,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46623931/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com