我对Nvidia的OpenCl/Cuda框架有疑问,但是我认为这是gcc链接问题。opencl_hello_world.c示例文件使用以下头文件:#include "../OpenCL/common/inc/CL/opencl.h"使用opencl.h使用以下头文件:#include <../OpenCL/common/inc/CL/cl.h>#include <../OpenCL/common/inc/CL/cl_gl.h>#include <../OpenCL/common/inc/CL/cl_gl_ext.h>#include <../OpenCL/common/inc/CL/cl_ext.h>所以所有的头文件都在同一个文件夹中。当我使用gcc opencl_hello_world.c -std=c99 -lOpenCL进行编译时,出现以下错误消息:error: ../OpenCL/common/inc/CL/cl.h: No such file or directoryerror: ../OpenCL/common/inc/CL/cl_gl.h: No such file or directory...即使cl.h和其他头文件位于此文件夹中。搜索完SO之后,我将opencl.h中的include更改为 #include "cl.h" #include "cl_gl.h"我在这里的阅读方式:gcc Can't Find a Included Header。但是,弄乱框架头文件似乎不是解决之道吗?解决这个问题的正确方法是什么? 最佳答案 您同时使用#include“”形式和#include ,它们不在同一路径中搜索。 “”是项目本地的,并且-i命令行指定给gcc,是-I指定给gcc的“系统”路径。您可能需要在gcc的命令行中使用-Ipath/to/includes设置包含路径。关于c - 找不到从头文件链接到的头文件。,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3667184/
10-11 22:13
查看更多