我正在尝试在我的 Windows 机器上构建一个 D 项目。它适用于mac,但在Windows中构建时出现以下错误,我在项目中使用命令“dub”并在某个时候得到它:
C:\Users\USER\AppData\Local\dub\packages\tinyredis-2.1.1\tinyredis\source\tinyredis\connection.d(145,30): Error: undefined identifier `EWOULDBLOCK`
dmd failed with exit code 1.
任何想法为什么这个 EWOULDBLOCK 变量在 Windows 上无法识别?
这是出现此标识符的 connection.d 部分:
private :
void receive(TcpSocket conn, ref byte[] buffer)
{
byte[1024 * 16] buff;
size_t len = conn.receive(buff);
if (conn.blocking)
{
if(len == 0)
throw new ConnectionException("Server closed the connection!");
else if(len == TcpSocket.ERROR)
throw new ConnectionException("A socket error occurred!");
}
else
{
if (len == -1)
{
import core.stdc.errno;
if (errno == EWOULDBLOCK)
{
len = 0;
errno = 0;
}
else
throw new ConnectionException(format("A socket error occurred! errno: %s", errno));
}
}
buffer ~= buff[0 .. len];
debug(tinyredis) { writeln("Response : ", "'" ~ escape(cast(string)buffer) ~ "'", " Length : ", len); }
}