function clGetPlatformIDs returning error


I am having Nvidia Geforce 9500 GT card, i have updated the drivers and installed NVidia cuda tool kit along with opencl, available on the website.
when i run the below code in my visual studio 2010. The function clGetPlatformIDs is returning -1001 and the value of the second argument of the function “test” is returned as NULL. I guess this means the device is not detected. Can some one please help in making my device getting detected.

#include <CL/opencl.h>

int main(int argc, char **argv)

cl_platform_id test;
cl_uint num;
cl_uint ok = 1;
cl_int result;
result = clGetPlatformIDs(ok, &test, &num);

return 0;



Can some one reply this, its urgent.

Thanks in advance…

I cant say what the problem is but there does not seem to be anything wrong with your code at least. It compiles and runs as expected on my system (code::blocks/MinGW/Quadro FX3800).

Without more information I guess my advise would be to make sure you have the correct drivers (also, drivers not necessarily to OpenCL but monitor/GPU related).

@Above Thanks for your reply, i found out where the problem is…

I working on windows 2008 server, I was running my codes from remote desktop… Today i tried running the codes on the server terminal and it worked correctly, all other sdk examples also.

Now my question is, is there any way to make the codes run properly with remote desktop connection also. Because we are about 7 users who connect to the server and do our codes. Do any one have any clue?