从头文件链接到的头文件未找到。 [英] Header files linked to from header file not found.

查看:132
本文介绍了从头文件链接到的头文件未找到。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Nvidia的的OpenCL / Cuda的框架问题,但我认为这是一个 GCC 连接问题。

I have a problem with Nvidia's OpenCl/Cuda framework, but I think it is a gcc linking issue.

opencl_hello_world.c 例如文件使用下面的头文件:

The opencl_hello_world.c example file uses following header file:

#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>

因此​​,所有的头文件都在同一个文件夹中。

So all the header files are in the same folder.

当我再与 GCC编译-std opencl_hello_world.c C99 = -lOpenCL 我收到以下错误消息:

When I then compile with gcc opencl_hello_world.c -std=c99 -lOpenCL I get following error messages:

error: ../OpenCL/common/inc/CL/cl.h: No such file or directory
error: ../OpenCL/common/inc/CL/cl_gl.h: No such file or directory
...

虽然 cl.h 和其他头文件位于此文件夹中。

Even though cl.h and the other header files are located in this folder.

搜索虽如此,我再变,包括在 opencl.h

Having searched SO, I then changed the includes in the opencl.h to

   #include "cl.h"
   #include "cl_gl.h"

我如何在这里读到: GCC不能找到一个包含的头

但与框架头文件乱搞似乎不是要走的路?什么是处理这个问题的正确方法?

But messing around with the frameworks header files does not seem like the way to go? What would be the proper way to handle this problem?

推荐答案

您要同时使用的#include形式的#include&LT;>,它不会在相同的路径进行搜索。 是本地的项目,并指定gcc的-I命令行,&LT;>是-I指定GCC的系统路径

You're using both #include "" form and #include <>, which don't search in the same paths. "" is local to your project, and the -i command line specified to gcc, <> is the 'system' path specified by -I to gcc.

您可能需要设定-ipath包含路径/到/包括GCC的命令行。

You probably need to set the include path with -Ipath/to/includes in gcc's command line.

这篇关于从头文件链接到的头文件未找到。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆