Home > Software design >  Cl/cl.h not found in Visual Studio Code 2019 AMD GPU Win10
Cl/cl.h not found in Visual Studio Code 2019 AMD GPU Win10

Time:04-21

I wanted to get started in GPU programming and since I have an AMD GPU I would like to start with OpenCL.

I have installed on my Windows 10 machine Visual Studio Code 2019 editor and I've also installed this https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK. I tried to put those variables inside the settings of VC2019 but nothing happened.

Can somebody help troubleshooting this problem? How did you manage to install OpenCL?

Thanks in advance

CodePudding user response:

When compiling your code, you need to tell the linker where the OpenCL headers and lib file are located. I usually put the headers and lib file inside the project directory:

g   *.cpp -o Test.exe -I./OpenCL/include -L./OpenCL/lib -lOpenCL

But you can also make the -Ipath/to/OpenCL/include -Lpath/to/OpenCL/lib paths point to the OCL-SDK directory.


For an easy start with OpenCL, I created a wrapper that vastly simplifies the OpenCL C bindings and eliminates the entire code overhead that comes with it. This includes the OpenCL headers and all Visual Studio Community project settings; no additional setup required: https://github.com/ProjectPhysX/OpenCL-Wrapper

  • Related