OpenCL-Getting-Started icon indicating copy to clipboard operation
OpenCL-Getting-Started copied to clipboard

Fix compiler warnings

Open FloEdelmann opened this issue 2 years ago • 0 comments

When running make with the original source file, I got the following warnings:

In file included from /usr/include/CL/cl.h:32,
                 from main.c:7:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
   34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
      |         ^~~~~~~
main.c: In function ‘main’:
main.c:50:5: warning: ‘clCreateCommandQueue’ is deprecated [-Wdeprecated-declarations]
   50 |     cl_command_queue command_queue = clCreateCommandQueue(context, device_id, 0, &ret);
      |     ^~~~~~~~~~~~~~~~
In file included from main.c:7:
/usr/include/CL/cl.h:1781:1: note: declared here
 1781 | clCreateCommandQueue(cl_context                     context,
      | ^~~~~~~~~~~~~~~~~~~~

I resolved them by specifying an explicit OpenCL version and replacing the deprecated clCreateCommandQueue call with the equivalent clCreateCommandQueueWithProperties.

FloEdelmann avatar Jul 25 '21 16:07 FloEdelmann