我是 Opencl 编程的新手。我在编译时编写了一个矩阵乘法程序给我错误我的包含文件是:
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#include <CL/cl.h>
#include <stdbool.h>
但我得到一个错误:
/usr/bin/ld: /tmp/ccxNPkyU.o: in function `main':
gmm.c:(.text+0x2d3): undefined reference to `clGetPlatformIDs'
/usr/bin/ld: gmm.c:(.text+0x2ef): undefined reference to `clGetPlatformIDs'
/usr/bin/ld: gmm.c:(.text+0x322): undefined reference to `clGetDeviceIDs'
/usr/bin/ld: gmm.c:(.text+0x376): undefined reference to `clCreateContext'
/usr/bin/ld: gmm.c:(.text+0x527): undefined reference to `clCreateCommandQueue'
/usr/bin/ld: gmm.c:(.text+0x5ab): undefined reference to `clCreateProgramWithSource'
/usr/bin/ld: gmm.c:(.text+0x5fc): undefined reference to `clBuildProgram'
/usr/bin/ld: gmm.c:(.text+0x64c): undefined reference to `clGetProgramBuildInfo'
/usr/bin/ld: gmm.c:(.text+0x682): undefined reference to `clCreateKernel'
/usr/bin/ld: gmm.c:(.text+0x6dc): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x70c): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x73c): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x76e): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x7a0): undefined reference to `clCreateBuffer'
/usr/bin/ld: /tmp/ccxNPkyU.o:gmm.c:(.text+0x7d2): more undefined references to `clCreateBuffer' follow
/usr/bin/ld: /tmp/ccxNPkyU.o: in function `main':
gmm.c:(.text+0x84c): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x875): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x89e): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x8c7): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x8f8): undefined reference to `clSetKernelArg'
/usr/bin/ld: /tmp/ccxNPkyU.o:gmm.c:(.text+0x929): more undefined references to `clSetKernelArg' follow
/usr/bin/ld: /tmp/ccxNPkyU.o: in function `main':
gmm.c:(.text+0xa58): undefined reference to `clEnqueueReadBuffer'
/usr/bin/ld: gmm.c:(.text+0xa9f): undefined reference to `clEnqueueReadBuffer'
/usr/bin/ld: gmm.c:(.text+0xae6): undefined reference to `clEnqueueReadBuffer'
/usr/bin/ld: gmm.c:(.text+0xb04): undefined reference to `clWaitForEvents'
/usr/bin/ld: gmm.c:(.text+0xb13): undefined reference to `clFinish'
/usr/bin/ld: gmm.c:(.text+0xb3c): undefined reference to `clGetEventProfilingInfo'
/usr/bin/ld: gmm.c:(.text+0xb65): undefined reference to `clGetEventProfilingInfo'
/usr/bin/ld: gmm.c:(.text+0xc9f): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xcae): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xcbd): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xccc): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xcdb): undefined reference to `clReleaseMemObject'
/usr/bin/ld: /tmp/ccxNPkyU.o:gmm.c:(.text+0xcea): more undefined references to `clReleaseMemObject' follow
collect2: error: ld returned 1 exit status
我正在通过以下语句编译程序:gcc -o gmmc gmm.c
. 谁能帮我