我正在尝试编译一个代码(不是我的;使用C与cuda通信),它有自己的makefile,并且我得到了以下错误消息:
icc -fPIC -vec-report1 -g -O3 -fno-strict-aliasing -DNDEBUG -I. -I/include -DUNIX -DCPU_RECOMPUTE=1 -DFULL_DOUBLE=0 -c classify_functions.cpp -o classify_functions.o
classify_functions.cpp(4): catastrophic error: cannot open source file "cuda_runtime.h"
#include <cuda_runtime.h>
^
compilation aborted for classify_functions.cpp (code 4)
make: *** [classify_functions.o] Error 4我使用了"locate“并检查了/usr/local/cuda/include/cuda_runtime.h是否存在;然后我尝试将它添加到.bashrc的PATH、LD_LIBRARY_PATH和C_INCLUDE_PATH变量中,但似乎都不起作用。icc头文件的路径是否还有其他变量?如果不是,为什么编译器不能打开该文件?
(我可以提供更多信息,但我真的不知道与此相关的是什么)
发布于 2017-11-10 00:46:25
在Linux (可能还有MacOS)中,编译器包含的路径是*
/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include库路径是
/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib因此,您只需确保cuda_runtime.h文件(以及其他必要的头文件)位于编译器路径中。
*假设正确安装了英特尔编译器icc,并将安装路径保留为默认路径。
https://stackoverflow.com/questions/16134354
复制相似问题