2015-03-25 27 views
0

我試圖用LiteIDE運行程序:如何將包含目錄添加到Go/LiteIDE?

// cudatest 
package cudatest 

import (
    "fmt" 
    "github.com/barnex/cuda5/cu" 
) 

func main() { 
    fmt.Println("Hello, your GPU is:", cu.Device(0).Name()) 
} 

我得到的是:

c:/go/bin/go.exe build -i [C:/godev] 
# github.com/barnex/cuda5/cu 
c:\GoDev\src\github.com\barnex\cuda5\cu\context.go:5:18: fatal error: cuda.h: No such file or directory 
//#include <cuda.h> 
     ^
compilation terminated. 
Error: process exited with code 2. 

我已經安裝了NVIDIA最新的CUDA SDK。爲了讓Go編譯器看到它,我需要做些什麼?

+0

你去獲得CUDA 5圖書館? – MIkCode 2015-03-25 09:21:06

+1

當然。我相信錯誤是Go編譯器無法找到庫所需的包含。 – jpreed00 2015-03-25 23:09:28

+0

你可以試試'去'嗎? – Sathya 2015-03-26 11:32:54

回答

1

它看起來像你的C編譯器不知道什麼目錄有cuda頭文件。你可以告訴去使用CGO_CPPFLAGS環境變量給C編譯器額外的選項。你可能想將其設置爲類似

CGO_CPPFLAGS="-isystem /path/to/dir/with/cuda/header/in/it" 

https://golang.org/cmd/cgo/

+0

我會調查這條道路並回報,謝謝! – jpreed00 2015-03-26 21:04:55

相關問題