【问题标题】:OpenCL CL/cl.h error on windows 7 with mingw32带有 mingw32 的 Windows 7 上的 OpenCL CL/cl.h 错误
【发布时间】:2013-06-16 16:26:52
【问题描述】:

我正在尝试使用 mingw32 中的以下命令编译我的 OpenCL 应用程序: mingw32-gcc -o plat plat.c

但我收到此错误: CL/cl.h 没有这样的文件或目录

我在整个网络和这个网站上搜索了很多次,但找不到任何好的答案。 我做了所有的工作,但它仍然出错。 我使用 AMD Radeon HD 5470 并在 win 7 上安装了最新的催化剂驱动程序和 AMD APP SDK 2.8 我已经安装了 VS 2012

在我的代码中,我使用了几个希望工作的状态,但是....它仍然会犯同样的错误

我还在编译命令中使用了-I & -L,但仍然报错:CL/cl.h no such file or directory

我怎么不知道如何使用 ma​​ke file 来编译代码

我会非常感谢任何帮助我的人:mehdioraki59@yahoo.com

我的系统是:dell studio 1558

这是我非常简单的测试代码:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifdef MAC
#include <OpenCL/cl.h>
#else
#include <C:\Program Files (x86)\AMD APP\include\CL\cl.hpp>
//#include <CL/cl.h>    >>>>>>>  i manually disabled this line but there is still error
#endif
int main() {
cl_platform_id             *platforms;
cl_uint                    num_platforms;
cl_int                     i, err, platform_index = -1;
char*                      ext_data;
size_t                     ext_size;
err = clGetPlatformIDs(1, NULL, &num_platforms);
if(err < 0) {
perror("Couldn't find any platforms.");
exit(1);
}
free(platforms);
return 0;
}

【问题讨论】:

  • 非常感谢。我做的 。但它仍然会犯同样的错误

标签: makefile opencl mingw32


【解决方案1】:

您需要在构建命令中添加 -I"C:\Program Files (x86)\AMD APP\include" 以告诉 mingw32-gcc 在哪里可以找到 CL/cl.h。使用它,#include 行应该可以正常工作。

【讨论】:

    【解决方案2】:

    我终于找到了答案,也谢谢你,chippies 先生: 你的建议如何帮助我更多 我使用了这个make文件: 项目=qwerty_mehdi CC=mingw32-gcc CFLAGS=-墙 LIB=-lOpenCL ifdef AMDAPPSDKROOT INC_DIRS="$(AMDAPPSDKROOT)include" LIB_DIRS="$(AMDAPPSDKROOT)lib\x86" 别的 ifdef NVSDKCOMPUTE_ROOT INC_DIRS="$(NVSDKCOMPUTE_ROOT)\OpenCL\common\inc" LIB_DIRS="$(NVSDKCOMPUTE_ROOT)\OpenCL\common\lib\Win32" 万一 万一 $(项目):qwerty.c $(CC) $(CFLAGS) -o $@ $^ -I$(INC_DIRS) -L$(LIB_DIRS) $(LIB)

    并且还删除了这一行: #包括

    在此之后.exe成功制作

    在 make 文件代码行中,qwerty.c 是我之前解释过的代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-03
      • 1970-01-01
      • 2015-04-18
      • 2016-04-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多