cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

opencl_JEDI
Journeyman III

Introductory Tutorial to OpenCL

Hi,

I implemented the hello world program in visual studio 2008,

like it's described in the tutorial, but when I build it I got

error C2664: 'cl:latform::get' : cannot convert parameter 1 from 'std::vector<_Ty> *' to 'cl::vector<T> *'

refering to this code line:

cl:latform::get(&platformList);

Thanks.

 

0 Likes
13 Replies
omkaranathan
Journeyman III

Introductory Tutorial to OpenCL

Could you post the code snippet which is causing the issue?

Also please check if you have got the same problem as this.

http://forums.amd.com/forum/messageview.cfm?catid=390&threadid=128437

0 Likes
opencl_JEDI
Journeyman III

Introductory Tutorial to OpenCL

actually I got the same problems that the topic you joined, and I resolve them, so this is an other error, this is the part of the code

 

and this is the entire error message:

error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'cl::string' (or there is no acceptable conversion)

cl_int err; //std::vector< cl::Platform > platformList; cl::vector< cl::Platform > platformList; cl::Platform::get(&platformList); checkErr(platformList.size()!=0 ? CL_SUCCESS : -1, "cl::Platform::get"); std::cerr << "Platform number is: " << platformList.size() << std::endl; // HERE I GOT THE ERROR //std::string platformVendor; cl::string platformVendor; platformList[0].getInfo(CL_PLATFORM_VENDOR, &platformVendor); std::cerr << "Platform is by: " << platformVendor << "\n"; cl_context_properties cprops[3] = {CL_CONTEXT_PLATFORM, (cl_context_properties)(platformList[0])(), 0};

0 Likes
omkaranathan
Journeyman III

Introductory Tutorial to OpenCL

I'm assuming that you got the error at

std::cerr << "Platform is by: " << platformVendor << "\n";

as that is where you are using cl::string.

'<<' operator doesnt recognize cl::string class. For that you will have to overload '<<' operator.

What you can do instead is std::cerr << "Platform is by: " << platformVendor.c_str() << "\n";

0 Likes
opencl_JEDI
Journeyman III

Introductory Tutorial to OpenCL

actually the error I'm getting is in a line before this one:

std::cerr << "Platform number is: " << platformList.size() << std::endl; // HERE I GOT THE ERROR

 

0 Likes
omkaranathan
Journeyman III

Introductory Tutorial to OpenCL

Originally posted by: opencl_JEDI actually the error I'm getting is in a line before this one:

 

std::cerr << "Platform number is: " << platformList.size() << std::endl; // HERE I GOT THE ERROR

 

 

 

opencl_JEDI,

Are you sure? I can't see any usage of cl::string in the above line. I am able to compile and run without any issues as expected. I can see that you have used cl::string to print platform vendor where I can reproduce the error as I said in my previous post.

 

0 Likes
opencl_JEDI
Journeyman III

Introductory Tutorial to OpenCL

you were right, that was the problem, I changed it and now it buil OK.

But when I debug it I get:

ERROR: Conext::Context() (-1)

do you know what might be causing this?

0 Likes
omkaranathan
Journeyman III

Introductory Tutorial to OpenCL

Please post your system information. Also please post the output of CLInfo sample.

0 Likes
opencl_JEDI
Journeyman III

Introductory Tutorial to OpenCL

system information:

windows7 32bit

intel core 2 duo CPU E8400 @3Ghz

Ram 4Gb

 

0 Likes
omkaranathan
Journeyman III

Introductory Tutorial to OpenCL

Could you please post the output of CLInfo sample?

0 Likes