CUDA 5.5 SDK's headers incompatible with Khronos cl.hpp for OpenCL 1.0/1.1

When I build app vs CUDA SDK 5.5 I get error:

cl.hpp(2996) : error C2664: ‘clEnqueueNativeKernel’ : cannot convert parameter 2 from ‘void (__cdecl *)(void *)’ to ‘void (__stdcall *)(void *)’
1> This conversion requires a reinterpret_cast, a C-style cast or function-style cast

When I build same app vs CUDA SDK 3.2 all compiles OK.
I checked used cl.hpp vs Kronos current one for OpenCL 1.1/1.0 - they are identical.
So, probably cl.h from CUDA SDK 5.5 is incompatible one.

You would do best to avoid the Nvidia OpenCL headers and just use the Khronos ones (actually I’d say that applies for AMD and Intel too).

Hello there,

I am having the same problem.

Downloaded the cl.hpp header from Kronos and copied to the include folder.
However, when i try to compile in Visual Studio 2012 i get the same error:

1>------ Build started: Project: OpenCL-1-HelloWorld, Configuration: Debug Win32 ------
1> Main.cpp
1>c:\program files\nvidia gpu computing toolkit\cuda\v5.5\include\cl\cl.hpp(2996): error C2664: ‘clEnqueueNativeKernel’ : cannot convert parameter 2 from ‘void (__cdecl *)(void *)’ to ‘void (__stdcall *)(void *)’
1> This conversion requires a reinterpret_cast, a C-style cast or function-style cast
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am using CUDA 5.5 and I have a GTX 680.
Here is my small code:

#define __NO_STD_VECTOR // cl::vector instead of std::vector
#include <CL/cl.hpp>

#include
#include
#include
#include
#include
#include

const std::string message(“I was processed by the GPU!”);

inline void checkErr(cl_int err, const char* name)
{
if (err != CL_SUCCESS)
{
std::cerr << “ERROR: " << name << " (” << err << “)” << std::endl;
exit(EXIT_FAILURE);
}
}

int main(int argc, char** argv)
{
cl_int err;
cl::vectorcl::Platform platforms;

cl::Platform::get(&platforms);
checkErr(platforms.size() > 0 ? CL_SUCCESS : -1, "cl::Platform::get");

std::cout << platforms.size() << " OpenCL platforms available." << std::endl;
std::string platformVendor;
for (cl::Platform platform : platforms)
{
	platform.getInfo((cl_platform_info) CL_PLATFORM_VENDOR, &platformVendor);
	std::cout << "Platform by: " << platformVendor << std::endl;
}

}

Thanks in advice!