[英]The procedure entry point clCreateCommandQueueWithProperties could not be located in the dynamic link library
我一直在尝试让 OpenCL 与 Visual Studio 一起工作。
我按照本指南配置AMD OpenCL SDK。
这是我的简短示例程序
#include "stdafx.h"
#include <CL/cl.h>
#include <stdio.h>
#include <iostream>
using namespace std;
const char *source =
"__kernel void memset( __global uint *dst ) \n"
"{ \n"
" dst[get_global_id(0)] = get_global_id(0); \n"
"} \n";
int main()
{
cl_platform_id platform;
clGetPlatformIDs(1, &platform, NULL);
cl_device_id device;
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
cl_context context = clCreateContext
(
NULL,
1,
&device,
NULL,
NULL,
NULL
);
cl_command_queue queue = clCreateCommandQueueWithProperties
(
context,
device,
0,
NULL
);
return 0;
}
但是当我运行它时,我收到了这个运行时错误
无法在动态链接库中找到过程入口点 clCreateCommandQueueWithProperties
我使用dll 导出查看器查看了 dll,该函数确实出现在OpenCL.dll
。
编辑
我认为 Mats Petersson 是对的 我在我的 PC 上进行了文件搜索,发现了多个 OpenCL.dll 文件
我不知道如何以明智的方式解决这个问题......
编辑
这里可能还值得注意的是,当我删除对clCreateCommandQueueWithProperties
的调用时,程序运行良好。
我的一些朋友建议将 OpenCL.DLL 文件复制到我的项目目录中。
这工作得很好。
我的程序一定是载入了错误的 dll 文件。
我将 C:\\Windows\\System32\\OpenCL.dll 替换为位于 C:\\Program Files (x86)\\AMD APP SDK\\3.0\\bin\\x86\\OpenCL.dll 中的那个
和
我将 C:\\Windows\\SysWOW64\\OpenCL.dll 替换为位于 C:\\Program Files (x86)\\AMD APP SDK\\3.0\\bin\\x86_64\\OpenCL.dll 中的那个
这对我有用。
当我尝试运行 QGIS 时出现此错误。
在 OSGeo4W 中重新安装 OpenCL 解决了该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.