I'm trying to build a simple kernel, but it fails when I use write_imageui. The kernel should just copy an image to another. I know that there isn't probably any sense in making such kernel, but I'm just trying to learn the language. Anyway, here is the kernel:

const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE |

__kernel void copy(image2d_t src, image2d_t dst)
int2 pos;
uint4 input;
int x = get_global_id(0);
int y = get_global_id(1);

pos.x = x;
pos.y = y;

input = read_imageui(src, sampler, pos);
write_imageui(dst, pos, input);

If I put it like above, clBuildProgram gives me error code -42 (btw how can I determine what error that is?). But if I comment the last line out it compiles just fine. Any idea what is going on?

P.S. I'm using Nvidia SDK and my GPU is GF9500GT.