c - 警告 : implicit declaration of function ‘sendto’

标签 c warnings

我有以下问题:

warning: implicit declaration of function ‘sendto’

在线变量outputCounterByte:

outputCounterByte += sendto(server_socket, outputBuff, offSet, 0, (struct sockaddr*) remote_addr, server_addr_len);

我不太明白,问题出在哪里? OutputCouterByte 的值为 0,并且定义了其他变量。我已经包含了所有标题(函数原型(prototype))。 在其他功能中它正在工作。

最佳答案

您需要包含

#include <sys/types.h>
#include <sys/socket.h>

提供函数原型(prototype)。

关于c - 警告 : implicit declaration of function ‘sendto’ ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27620847/

相关文章:

R 函数 : Print Warning Only on First Call of Function

C: 类型转换警告

c++ - 使用 gcc 4.1.2 抑制代码块的警告?

c - 变量 'x' 周围的堆栈已损坏

c - 为条形码读取器读取数据并将其写入缓冲区的最佳方法是什么?

iphone - NSValue 可能不会响应...警告

perl - 如果生成警告,如何让 Perl 死掉?

c - 如何为 Visual Studio 2005 安装 pthread_win32(Windows pthread/posix 线程库)?

c - 在声明的 C 字符串上添加 CRLF

C 函数指针、可微函数