Hi,
I’m just starting to explore OpenCL. I’ve found this tutorial - Introductory Tutorial to OpenCL™ - CodeProject - and I’m having some troubles.
Here is my code from just the start of the tutorial:
#include <utility>
#define __NO_STD_VECTOR // Use cl::vector instead of STL version
#include <CL/cl.h>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
#include <iterator>
int main(void) {
cl_int err;
cl::vector< cl::Platform > platformList;
cl::Platform::get(&platformList);
return 0;
}
I had to change CL/cl.hpp (in the tutorial) to CL/cl.h (in my code) because I only have cl.h on my machine. When I try to compile this code, I get:
In function 'int main()':
error: 'cl' has not been declared
error: 'cl' has not been declared
error: 'platformList' was not declared in this scope
error: 'cl' has not been declared
warning: unused variable 'err'
||=== Build finished: 4 errors, 1 warnings ===|
I have added the OpenCL include path, library path and OpenCL library to my build settings.
I have been able to successfully compile and run the vector addition application found here: http://www.thebigblob.com/getting-started-with-opencl-and-gpu-computing/. It appears that the code between the two applications are of different styles:
// From tutorial
cl::Platform::get(&platformList);
// From vector addition application
cl_int ret = clGetPlatformIDs(1, &platform_id, &ret_num_platforms);
Are there two different versions of OpenCL? Any help on why I can’t compile the tutorial code would be greatly appreciated! Also, any other good resources or tutorials for starters would be appreciated as well!