Search code examples
cwindowsheaderopencl

Include OpenCL headers on Windows with AMD GPU


I'm trying to compile an OpenCL program on my Windows machine. What I first found was using the #include <CL/cl.h> header, but it seems I don't have it installed.

So after looking around for a while, I found that people recommend using OCL_SDK_Light to include the headers and libraries on Windows with AMD GPU. I installed it, but as I'm not very used to C language, I've been having trouble including these headers in my file.

In the README of the OCL_SDK_Light, what's written is

This light SDK for OpenCL only installs the required component to compile an OpenCL program
It also creates the following environment variable OCL_ROOT which points to the installation path of this SDK
To include the headers and library in your project, you can then use the following
${OCL_ROOT}\include
${OCL_ROOT}\lib\x86
${OCL_ROOT}\lib\x86_64

But I don't understand the lines explaining how to use it in a project, which leads to me being at a loss for what to do.

How should I include the headers file I just downloaded ?


Solution

  • You need to tell the linker where to find the header files and the lib file. See this answer.