# Visual Studio 2012 can't find the opencl header files.

Question asked by shaboinkin on Aug 20, 2014

My environment variable for the AMD APP SDK:

AMDAPPSDKROOT

C:\Program Files (x86)\AMD APP SDK\2.9\

In visual studio, I include additional directories by

\$(AMDAPPSDKROOT)\include;

Which I then include the opencl headers by

#include <CL\cl.h>

#include <CL\opencl.h>

Visual studio complains that it can't find those header files. So I gave the full path of the directory instead of the environment variable but Visual Studio still can't find the header files.

Only if I include the entire path in my #include will Visual Studio find these header files.

What am I doing wrong?

Edit:

What's interesting is that if I download the opencl headers from khronos, and toss a cl folder in C:\, and include that folder through "Additional Include Directories". It is able to find the header files.
So I removed that folder of the files I just downloaded, copy/pasted the opencl folder that AMD provided with the SDK in C:\, and tried to include it like that, and it worked as intended.

What's the difference between those two directories? C:\ verses C:\Program Files (x86)\AMD APP SDK\2.9\include? The permissions on that folder in the AMD folder are set properly so it couldn't be because of that..

Wait, nevermind. I found that if I made a folder in C:\, tossed the CL folder containing the header files in that new folder, and tried to include from it, the same thing happened with VS saying it can't find the file.

So now it is C:\OpenCL\CL

So VS can see headers fine if it is C:\CL

but it can't see the headers if it is C:\OpenCL\CL