TrueStop16
TrueStop16

Reputation: 23

Cl/cl.h not found in Visual Studio Code 2019 AMD GPU Win10

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 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?

Upvotes: 2

Views: 1176

Answers (1)

ProjectPhysX
ProjectPhysX

Reputation: 5736

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 how to setup OpenCL with VS Community, see here: https://stackoverflow.com/a/57017982/9178992


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

Upvotes: 1

Related Questions