dongyou7739 2015-05-14 14:06
浏览 357
已采纳

SWIG + Go:不使用cgo时不允许C源文件

I am trying to wrap this library (https://github.com/lemire/EWAHBoolArray) in Go using SWIG, but I'm having a lot of problems since I upgraded to 1.4

I had successfully gotten everything to work using Go 1.3.3 and following the instructions on the SWIG site for SWIG + Go. I had to compile and install the package manually instead of using go build, but everything was working fine.

Now, when I try to run the same program with Go 1.4.2, I get this error:

ewah_usage.go:5:2: C source files not allowed when not using cgo: goewah_gc.c

I rebuilt the package using the latest SWIG and the latest Go, and it seems to have installed correctly. But whenever I run a program using the library, I get the above error.

My test program (goewah is the library I built with SWIG)

package main

import (
    "fmt"
    "bitbucket.org/evanh/goewah"
)

func main() {
    x := goewah.NewEWAHBoolArray()
    x.Set(1)
    x.Set(2)
    fmt.Println(x.Get(1))
}
  • 写回答

1条回答 默认 最新

  • dongwu5318 2015-05-15 16:02
    关注

    It's a bug. Sorry. Add a file that just says

    package p
    import "C"
    

    and you should get around it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 C#i编程中so-ir-192编码的字符集转码UTF8问题
  • ¥15 51嵌入式入门按键小项目
  • ¥30 海外项目,如何降低Google Map接口费用?
  • ¥15 fluentmeshing
  • ¥15 手机/平板的浏览器里如何实现类似荧光笔的效果
  • ¥15 盘古气象大模型调用(python)
  • ¥15 传人记程序做的plc 485从机程序该如何写
  • ¥15 已知手指抓握过程中掌指关节、手指各关节和指尖每一帧的坐标,用贝塞尔曲线可以拟合手指抓握的运动轨迹吗?
  • ¥50 libwebsockets 如何添加其他socket事件回调
  • ¥50 实现画布拖拽算子排布,通过flink实现算子编排计算,请提供思路
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部