相关疑难解决方法(0)

库已链接但引用未定义

我正在尝试用UIDntu编译一个openCL程序,其中NVIDIA卡曾经使用过一次,

#include <CL/cl.h>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  cl_platform_id platform;
  cl_device_id device;
  cl_context context;
  cl_command_queue command_queue;
  cl_int error;

  if(clGetPlatformIDs(1, &platform, NULL) != CL_SUCCESS) {
    cout << "platform error" << endl;
  }

  if(clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL) != CL_SUCCESS) {
    cout << "device error" << endl;
  }

  context = clCreateContext(NULL, 1, &device, NULL, NULL, &error);
  if(error != CL_SUCCESS) {
    cout << "context error" << endl;
  }

  command_queue = clCreateCommandQueue(context, device, 0, &error);
  if(error != CL_SUCCESS) { …
Run Code Online (Sandbox Code Playgroud)

c++ ubuntu linker opencl

34
推荐指数
3
解决办法
5万
查看次数

标签 统计

c++ ×1

linker ×1

opencl ×1

ubuntu ×1