dousi3362 2014-12-08 15:53
浏览 211

syscall变量未定义

When trying to build the following program on my Mac I get a build error: undefined: syscall.TCPInfo even though that variable is clearly documented http://golang.org/pkg/syscall/#TCPInfo

package main

import "syscall"

func main() {
    _ = syscall.TCPInfo{}
}

Here is my go tool version.

$ go version
go version go1.3 darwin/amd64

I thought this might be an issue a lack of OS support so I tried it on http://play.golang.org, but it looks like many documented variables are just randomly missing from the syscall package: http://play.golang.org/p/w3Uk6NaZVy

Am I missing something?

  • 写回答

1条回答 默认 最新

  • douwen1313 2014-12-08 18:40
    关注

    The variable specified inside syscall are OS dependent.

    you can add a suffix to the file to specify which os they should be built for:

    // +build linux,386 darwin,!cgo
    

    So you can use specific syscall flags for each OS.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog