duanpai9945 2015-09-19 16:20
浏览 813

cgo编译错误:iostream:38:28:致命错误:bits / c ++ config.h:没有此类文件或目录

I tried to execute the saxpy exemple from the official cuda nvrtc guide in this page

It works fine with the g++ compiler on terminal and following the build instructions:

g++ saxpy.cpp -o saxpy -I $CUDA_PATH/include -L $CUDA_PATH/lib64 -lnvrtc -lcuda -Wl,-rpath,$CUDA_PATH/lib64

Now I'm trying to execute it in go language with the cgo tool. I named main function in "my_function" and I'm trying to call it with C.my_function.

this is my cgo directives:

//PATH
#cgo LDFLAGS: -L/usr/local/cuda-7.0/lib64 -L/usr/local/cuda-7.0/lib -lcuda -lnvrtc
#cgo CPPFLAGS: -I/usr/local/cuda-7.0/include/ -I/usr/include/c++/4.8

//FILE
#include "saxpy_header.h"
#include <nvrtc.h>
#include "iostream"
#include <cuda.h>

But I get this error message:

/usr/include/c++/4.8/iostream:38:28: fatal error: bits/c++config.h: No such file or directory
#include <bits/c++config.h>

So I tried this:

#include "/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++config.h"

And now I get this new error message:

/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++config.h:430:29: fatal error: bits/os_defines.h: No such file or directory
#include <bits/os_defines.h>

After adding #include "/usr/include/x86_64-linux-gnu/c++/4.9/bits/os_defines.h" I get the same error...

How can i solve this problem?

  • 写回答

1条回答 默认 最新

  • douqie3391 2015-09-19 16:44
    关注

    Just a wild guess here since I know nothing of go / cgo...

    It looks like you have amix-up between version 4.8 and 4.9 of the g++ complier.

    I would try to change the cgo CPPFLAGS line accordingly, to this:

    #cgo CPPFLAGS: -I/usr/local/cuda-7.0/include/ -I/usr/include/c++/4.9
    

    But again, just guessing...

    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程