I wondered how to include a standard c header file into my cl file. If I try this, the compiler throws an error with the message: “Cannot find header file” although I put the header file in the same directory as the cl file. How can I access existing header files from my opencl file?
You don’t include using the standard “include” syntax. When you call clCreateProgramWithSource pass the additional header file in. Note, the strings argument takes multiple strings. I’ve also found the order you specify the multiple strings of data matters.
ok, but I’m now using oclLoadProgSource() to get my source string and pass it as the string parameter of the clCreateProgramWithSource function. how do i add additional header files to that string? is this possible?
I stumbled on this post during a Google search and I wanted to ask a question. When I do a clBuildProgram command, I get no feedback about any errors during compilation. How do you get meaningful errors returned? Thanks in advance for your help.
You can use clGetProgramBuildInfo(). I don’t have the specs at hand, but if you look at the Khronos spec, you will find how to use it. Basically, it takes a string buffer and writes the error message into it.