Compiler construction 试着让CUDA工作,样品罐';我找不到帮手

Compiler construction 试着让CUDA工作,样品罐';我找不到帮手,compiler-construction,cuda,compilation,compiler-errors,Compiler Construction,Cuda,Compilation,Compiler Errors,我刚刚安装了CUDA,并一直在关注 在我尝试将deviceQuery之类的示例代码复制到~/Desktop并编译之前,一切正常 我在编译时遇到以下错误: /Developer/NVIDIA/CUDA-5.5/bin/nvcc -ccbin g++ -I../../common/inc -m64 -Xcompiler -arch -Xcompiler x86_64 -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,cod

我刚刚安装了CUDA,并一直在关注

在我尝试将deviceQuery之类的示例代码复制到~/Desktop并编译之前,一切正常

我在编译时遇到以下错误:

/Developer/NVIDIA/CUDA-5.5/bin/nvcc -ccbin g++ -I../../common/inc  -m64 -Xcompiler -arch -Xcompiler x86_64   -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=\"sm_35,compute_35\" -o deviceQuery.o -c deviceQuery.cpp
deviceQuery.cpp:23:25: error: helper_cuda.h: No such file or directory
deviceQuery.cpp: In function ‘int main(int, char**)’:
deviceQuery.cpp:111: error: ‘SPRINTF’ was not declared in this scope
deviceQuery.cpp:116: error: ‘_ConvertSMVer2Cores’ was not declared in this scope
deviceQuery.cpp:206: error: ‘checkCudaErrors’ was not declared in this scope
deviceQuery.cpp:230: error: ‘checkCudaErrors’ was not declared in this scope
deviceQuery.cpp:241: error: ‘checkCudaErrors’ was not declared in this scope
make: *** [deviceQuery.o] Error 1

代码将在CUDA目录中编译和运行,很明显编译器找不到helper_CUDA.h,我也找不到它。有人有解决方案吗?

如编译选项
-I..//common/inc
所示,
helper_CUDA.h
位于
$CUDA\u HOME/samples/common/inc/

如果要将样本复制到自定义位置,则必须复制整个
样本
dir,或修改一些代码/编译选项以将人员包含在
common/
dir中。

NVIDIA CUDA工具包包括源代码形式的示例程序。您应该通过更改为~/NVIDIA_CUDA-8.0_Samples并键入make来编译它们。生成的二进制文件将放在~/NVIDIA_CUDA-8.0_Samples/bin下

只要确保:

$export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}

$export LD\u LIBRARY\u PATH=/usr/local/cuda-8.0/lib64\
${LD\u LIBRARY\u PATH:+:${LD\u LIBRARY\u PATH}

$nvcc-V

应该显示版本

$cd~/some_path/NVIDIA_CUDA-8.0_示例

$make