gcc -o CANserver CANserver.c发生错误
首先是:
1、warning incompatible implicit declaration of built-in function 'printf'错误
解决:缺少头文件#include <stdio.h>。
2、 CANserver.c: In
function ‘main’:
CANserver.c:35: warning: passing argument 6 of ‘recvfrom’ from incompatible pointer type
/usr/include/x86_64-linux-gnu/sys/socket.h:166: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘long unsigned int *’
原因:(翻译)在main主程序中有问题,recvfrom函数的第六个参数类型不对,为long unsigned,但其实应该为int类型