c++openclopencl-copencl-c++

CL/cl.hpp: No such file or directory | NVIDIA GeForce


Good afternoon! I'm trying to run code in C++ that has the following line:

#include <CL/cl.hpp>

But launching the program gives this error:

fatal error: CL/cl.hpp: No such file or directory

What have I tried to do?

  1. Completely reinstalling mingw64
  2. Uninstalled Visual Studio 2019 and installed Visual Studio 2022
  3. Installed NVIDIA Cuda according to the instructions (I also updated the NVIDIA drivers): https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html

Cuda is fully operational. I checked with the code examples that come with CUDA.

P.S. As far as I know, OpenCl is part of CUDA.

Thanks!


Solution

  • It is best to include the OpenCL headers in the same directory where the source code of your Visual Studio Project is. You then have to tell Visual Studio where these files are located. To configure the project and set the file paths, see this answer.

    You don't need to install CUDA at all. The OpenCL Runtime is included in the Nvidia graphics drivers already.