如何将一个Int从c函数返回到Swift代码

如何将一个Int从c函数返回到Swift代码,c,xcode,swift,output,return-value,C,Xcode,Swift,Output,Return Value,我在从c代码返回整数到swift代码时遇到问题 我试图在我的swift代码中实现这一点: // Connect if(connectToHost(address, port) < 0) { println("Error connecting!") exit(1); } 我遇到的错误是:找不到“的重载。请尝试此操作- if(Int(connectToHost(address, port)) < 0) { println("Error connecting!")

我在从c代码返回整数到swift代码时遇到问题

我试图在我的swift代码中实现这一点:

// Connect
if(connectToHost(address, port) < 0)
{
    println("Error connecting!")
    exit(1);
}
我遇到的错误是:找不到“的重载。请尝试此操作-

if(Int(connectToHost(address, port)) < 0)
{
    println("Error connecting!")
    exit(1);
}

如果IntconnectToHostaddress端口<0如何?您使用哪个xCode版本?你的代码对beta 5是有效的。我认为如果你对你的意图做一些解释,对OP和其他访问者会更有帮助。
if(Int(connectToHost(address, port)) < 0)
{
    println("Error connecting!")
    exit(1);
}