Grayscaling OpenCL,

I am working on OpencL grayscale code using c++. I am just a beginner in this, This is just a 2nd code from me with OpenCL. It is showing, invalid arguments errors in enquecommands.I am not able to solve why!!? can anyone helps me in this. Also I would some review that is it okay? I have uses buffer instead of image objects just for the try. I will try with image objects later on.

const int width;
const int height;
float *vec_h;
long count = width*height;

// std::vector<float> size(width*height,1);
vec_h = (float )malloc(countsizeof(float));

std::vector&lt;cl::Platform&gt; plat;
std::vector&lt;cl::Device&gt;dev;

try
{
	//Find OCL platform
	cl::Platform::get(&plat);
	string value;
	if(plat[0].getInfo(CL_PLATFORM_NAME,&value)!=CL_SUCCESS)
	{
		std::cout&lt;&lt;"No platform found"&lt;&lt;std::endl;
	}
	else
		cout&lt;&lt;"Platform found : "&lt;&lt;value&lt;&lt;endl;

	//Find device


	if(plat[0].getDevices(CL_DEVICE_TYPE_GPU,&dev)!=CL_SUCCESS)
	{
		std::cout&lt;&lt;"No device found"&lt;&lt;std::endl;
	}


	//Create Context

	cl::Context ctxt(dev,nullptr,0,0,&error);

	//Create CommandQueue

	cl::CommandQueue cque(ctxt,dev,CL_QUEUE_PROFILING_ENABLE);

	//Create Program
	std::ifstream sourceFileName("Test1.cl");
	std::string sourceFile(std::istreambuf_iterator&lt;char&gt;(sourceFileName),(std::istreambuf_iterator&lt;char&gt;()))
	cl::Program::Sources gray_source(1,std::make_pair(sourceFile.c_str(),sourceFile.length()+1));
	cl::Program prog(ctxt,gray_source);

	//BuildProgram

	prog.build(dev);

	//Create Kernels

	cl::Kernel kernel(prog,"Grayscale",&error);

	//Memory Objects
	cl::Memory input, output;

	input = cl::Buffer(ctxt,CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,width*height,NULL,&error);

	output =cl::Buffer(ctxt,CL_MEM_WRITE_ONLY,width*height,0,&error);

	 //Setting Kernel Arguments

	if(kernel.setArg(0, input)!=CL_SUCCESS)
	 {
	 	 std::cout&lt;&lt;"Error on input arg"&lt;&lt;std::endl;
	 }
	if(kernel.setArg(1, output)!=CL_SUCCESS)
	 {
	 	 std::cout&lt;&lt;"Error on output arg"&lt;&lt;std::endl;
	 }

	//Profiling Event

	cl::Event e1;


	const cl::NDRange globalsize = width*height;


	//Enqueue Task

	cque.enqueueTask(kernel,NULL,&e1);




	//Write to target device
	cque.enqueueWriteBuffer(input,CL_TRUE,0,width*height*sizeof(float),vec_h,0,NULL,&e1);

	cque.enqueueNDRangeKernel(kernel,0,globalsize,0,NULL,&e1);

	cque.enqueueReadBuffer(output,CL_TRUE,0,width*height*sizeof(float),vec_h,NULL,&e1);


}

extra argument [SOLVED]