在OS X上使用portaudio-go构建一个go项目(+MacPorts)

huangapple go评论79阅读模式
英文:

Building a go project with portaudio-go on OS X (+MacPorts)

问题

我试图在Mac OS X 10.8下运行portaudio-go。我通过以下命令安装了portaudio:

sudo port install portaudio

这样portaudio.h就位于/opt/local/include。由于该文件夹不是默认的头文件位置,当我运行以下命令时:

go get code.google.com/p/portaudio-go/portaudio

我收到一个错误,说找不到portaudio.h。是否有类似于-I /opt/local/include的选项可以用于go?

英文:

I try to get portaudio-go running under Mac OS X 10.8. I installed portaudio via

sudo port install portaudio

so that now portaudio.h is located in /opt/local/include. Since the folder is not a default location for header-files, when running

go get code.google.com/p/portaudio-go/portaudio

I get an error saying that the portaudio.h could not be found. Is there something equivalent to -I /opt/local/include I could use for go?

/edit: Answered

答案1

得分: 1

我修改了portaudio.go的前几行:

package portaudio

/*
#cgo CFLAGS: -I/opt/local/include
#cgo LDFLAGS: -L/opt/local/lib -lportaudio

现在一切都正常了,谢谢!

英文:

I modified the first lines of portaudio.go:

package portaudio

/*
#cgo CFLAGS: -I/opt/local/include
#cgo LDFLAGS: -L/opt/local/lib -lportaudio

Now everything works fine, thank you!

huangapple
  • 本文由 发表于 2013年5月22日 00:38:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/16675135.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定