Relearning C++ for the sake of using OpenCL. I have created a Helper Class called CheckDevice which has a bunch of boiler plate code for getting device stats.
CheckDevice.h
class Utils
{
public:
Utils(){};
~Utils(){};
template<class T>
static bool IsNull(T Object, char* name);
private:
};
CheckDevice.cpp
cl_command_queue Utils::CreateCommandQueue(cl_context context, cl_device_id *device)
{
cl_int err;
cl_device_id *devices;
cl_command_queue queue = NULL;
size_t deviceBufferSize = -1;
cl_kernel kernel = 0;
Utils::IsNull<cl_command_queue>(queue, "Utils::CreateCommandQueue::queue");
return queue;
}
main.cpp
void main()
{
cl_kernel kernel = 0;
Utils::IsNull<cl_kernel>(kernel, "clCreateKernel");
}
The question is when calling the function Utils::IsNull from within CheckDevice.cpp it works fine but when calling from main.cpp than I get the following in Visual Studios 2012
error LNK2019: unresolved external symbol "public: static bool __cdecl Utils::IsNull(struct _cl_kernel *,char *)" (??$IsNull@PAU_cl_kernel@@@Utils@@SA_NPAU_cl_kernel@@PAD@Z) referenced in function _main 1>C:\Users\Suri\Documents\Visual Studio 2012\Projects\HelloWorld\Debug\HelloWorld.exe : fatal error LNK1120: 1 unresolved externals
Any Help would be apperciated