dsy19811981 2017-05-22 00:07
浏览 4
已采纳

如何让Go查找库头?

I've been searching for a while but cannot find a solution to this issue.

Because libraries like SDL2 are not part of the OpenBSD operating system, they are stored in /usr/local. Go seems to be looking for headers in /usr/include and not /usr/local/include. I see flags in go env but I'm unable to edit them.

Is there a way to resolve this issue without symlinks? Perhaps a Go equivalent of the -I flag common in C compilers?

  • 写回答

1条回答 默认 最新

  • dounuo7954 2017-05-22 01:26
    关注

    If you're using Cgo, you must use something like this:

    /*
    #cgo CFLAGS: -I/usr/local/ssl/include
    #cgo LDFLAGS: -lcrypto -L/usr/local/ssl/lib
    */
    import "C"
    

    In this case I'm using it to compile against the latest OpenSSL. Edit to suit your needs.

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

报告相同问题?

悬赏问题

  • ¥15 35114 SVAC视频验签的问题
  • ¥15 impedancepy
  • ¥15 在虚拟机环境下完成以下,要求截图!
  • ¥15 求往届大挑得奖作品(ppt…)
  • ¥15 如何在vue.config.js中读取到public文件夹下window.APP_CONFIG.API_BASE_URL的值
  • ¥50 浦育平台scratch图形化编程
  • ¥20 求这个的原理图 只要原理图
  • ¥15 vue2项目中,如何配置环境,可以在打完包之后修改请求的服务器地址
  • ¥20 微信的店铺小程序如何修改背景图
  • ¥15 UE5.1局部变量对蓝图不可见