I originally posted this on the AMD OpenCL forum, but since I wasn’t getting any replies and this may be more related to a misunderstanding of mine with the OpenCL spec than my usage of the AMD APP SDK, I’m cross posting it here as well.
I’m trying to experiment using clIcdGetPlatformIDsKHR, but I can’t even seem to get my first test code to compile. I’m using the Visual Studio 2010 with the AMD APP SDK 2.6 and Catalyst 12.4–installed after the SDK. I’ve added (AMDAPPSDKROOT)include and (AMDAPPSDKROOT)lib\x86_64 (for x64) to the include and library directories, respectively, and added the OpenCL.lib to the linked libraries. Here’s the short source code
status |= clIcdGetPlatformIDsKHR(num_platforms, platforms, &num_platforms);
platforms = new cl_platform_id[num_platforms];
status |= clIcdGetPlatformIDsKHR(num_platforms, platforms, &num_platforms);
delete [] platforms;
return status;
}
and error
error LNK2019: unresolved external symbol clIcdGetPlatformIDsKHR referenced in function main
Could anyone guess as to what’s causing this error and how I could fix it? Thanks!
Thank you for pointing that out; however I still get the same error even after including that extension enable line at the beginning or end of the header include section.
The platform supports the cl_khr_icd extension, although I don’t see it listed under any of the device extensions. Since this function is called on the host side it should work, right?
I wanted to bump this thread, as I have the same problem.
It seems to me that I might be supposed to use clGetExtensionFunctionAddressForPlatform to get a pointer to the actual function, but because that function requires a platform to be passed in, I’m quite confused, since I need clIcdGetPlatformIDsKHR to get all the platform IDs as a starting point.
Also, I don’t think #pragma OPENCL EXTENSION cl_khr_icd : enable would help at all. The way I understand it (from my limited experience with OpenCL and my reading of the specs) that pragma applies to OpenCL C code meant to be compiled and run on the device, not to host code as we are discussing here. However, it is very likely that I may be missing something.
I must add that my code is already working using clGetPlatformIDs, and my device does support the cl_khr_icd extension. I’m on Windows 7, using VS11 Beta, with AMD APP SDK 2.7.
Thanks in advance for any help, advice, pointers, etc.!