报错--01

1.  address family not support by protocol    添加这一句:serveraddr.sin_family = AF_INET; UDP协议 sendto 和 recvfrom 浅析与示例 

2.  编译出错

报错--01_第1张图片

把 #include <./include2/test27.hpp> 改为  #include "./include2/test27.hpp"   就可以了。

#include<>直接从编译器自带的函数库中寻找文件,#include""是先从自定义的文件中找 ,如果找不到在从函数库中寻找文件。

3. 应输入“;”C/ 

我一定义函数就报这个错误,后来发现,我在函数内部,定义函数了。

4. 用libpcap编写抓包程序编译时候出错: 错误信息:/tmp/ccoIJ1wR.o(.text+0x2ae): In function 'main'::_百度知道 (baidu.com)

/usr/bin/ld: /tmp/ccqummkU.o: in function `main':
main.c:(.text+0x14): undefined reference to `test01'
collect2: error: ld returned 1 exit status

c语言多文件编程,即main文件调用其他.c文件的方法_脱去三千烦恼丝-CSDN博客_c语言程序调用外部文件

5. warning: implicit declaration of function ‘test01_02’; did you mean ‘test02’? [-Wimplicit-function-declaration]

隐形声明警告解决//warning: implicit declaration of function ‘XXX’; did you mean ‘YYY’?_ControlLearner的博客-CSDN博客

6.  warning: null argument where non-null required (argument 2) [-Wnonnull]
   30 |         execl("child_process",NULL);

execl("child_process"," ",NULL);  这样写不报错了。

7. recvfrom bad address 

recvfrom: Bad address_小易-CSDN博客

主要在于最后一个参数的格式: rev_len = recvfrom(sockfd, buffer, sizeof(buffer), 0, (struct sockaddr*)&servaddr, (socklen_t*)&servaddr_len);

8. warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration] 

隐形声明警告解决//warning: implicit declaration of function ‘XXX’; did you mean ‘YYY’?_ControlLearner的博客-CSDN博客

 

你可能感兴趣的:(故障与调试,软件开发)