'select' must be imported from module 'Darwin.POSIX.sys.time'

报错:

workspaceios/xxx/xxx/Utils/Utils.m:468:27: Declaration of 'select' must be imported from module 'Darwin.POSIX.sys.time' before it is required

调用语句:

struct timeval tm = {3, 0};
fd_set wset,rset;
FD_ZERO(&wset);
FD_ZERO(&rset);
FD_SET(socketFileDescriptor,&wset);
FD_SET(socketFileDescriptor,&rset);
long t1 = time(NULL);
int res = select(socketFileDescriptor+1,&rset,&wset,NULL,&tm);

解决方法:

添加头文件:
#import <sys/time.h>

猜你喜欢

转载自blog.csdn.net/lllkey/article/details/82181070