构建Go SWIG示例代码

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

Building the Go SWIG example code

问题

我正在尝试构建Go附带的示例SWIG绑定。我正在查看的文件位于misc/swig/callback目录下。

是否有关于如何构建此示例的说明?我尝试按照这里的说明进行操作:
http://www.swig.org/Doc2.0/Go.html
但是由SWIG生成的代码似乎无法使用g++编译(因为它使用了C++库),并且无法使用g++编译(出现多个编译错误)。

有人成功构建过这个示例吗?

谢谢!

英文:

I'm trying to build the example SWIG bindings that come with Go. The files I'm looking at are located in misc/swig/callback.

Are there instructions on how to build this example? I tried following the directions here:
http://www.swig.org/Doc2.0/Go.html
but the code generated by SWIG doesn't seem to compile with g++ (since it uses a C++ library <string>) and doesn't compile with g++ (with multiple compilation errors).

Has anyone built this example successfully?

Thanks!

答案1

得分: 1

例如,

$ export GOPATH=$HOME/gopath
$ cd $GOPATH/src/swig/callback
$ go clean
$ go install -v
swig/callback
$ 

由于你说你在使用g++时遇到了问题,你是否已经安装了所有与g++相关的内容?例如,

$ sudo apt-get install g++ g++-multilib libstdc++6
$ g++ --version
g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
英文:

For example,

$ export GOPATH=$HOME/gopath
$ cd $GOPATH/src/swig/callback
$ go clean
$ go install -v
swig/callback
$ 

Since you say you had problems with g++, do you have everything installed for g++? For example,

$ sudo apt-get install g++ g++-multilib libstdc++6
$ g++ --version
g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3

huangapple
  • 本文由 发表于 2013年6月10日 22:14:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/17025967.html
匿名

发表评论

匿名网友

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

确定