Go使用swig调用C++11代码的问题

xpbhere 2015-10-12 05:55:41
请问下有没有使用swig调用c++11代码的成功案例?

我这边按照 http://www.swig.org/Doc3.0/Go.html 一文的提示操作,在调用 go install 时会出现
“This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.”
的提示。

不知道这个问题要如何解决呢?
...全文
106 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
xpbhere 2015-10-13
  • 打赏
  • 举报
回复
已用cgo的方案解决,在调用的go文件前面的C注释里加上
// #cgo CXXFLAGS: -g -std=c++11 -pedantic -Wno-c++11-extensions -O2 -fPIC
即可,放弃之前使用的swig方案。

2,190

社区成员

发帖
与我相关
我的任务
社区描述
go语言学习与交流版
社区管理员
  • go语言社区
  • Freeman Z
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧