Somebody Help Me -> Error operator '<'

Somebody can help me? I have NVIDIA Toolkit 4.1 and have program
#include <cuda.h>
#include <cuda_runtime.h>
global void colordepthmap(BYTE* colorFrame, BYTE* mappedColor, LONG* colorCoordinates, int CtoDdiv)

void mappingFunc(BYTE* h_colorFrame, BYTE* h_mappedColor, LONG* h_colorCoordinates, int CtoDiv)

dim3 threadsPerBlock(16,16,1);
dim3 blocksPerGrid((CWIDTH+ 16)/16, (CHEIGHT+ 16-1)/16, 1);
colordepthmap <<< blocksPerGrid, threadsPerBlock>>>(d_colorFrame, d_mappedColor, d_colorCoordinates, CtoDiv);


And have error → error C2059: syntax error : ‘<’
operator ‘<’ in before blockPerGrid

Thanks a lot

Make sure that CUDA specific code, e.g. global functions and kernel calls like colordepthmap<<< blocksPerGrid, threadsPerBlock>>>(…) are in .cu files and are compiled using nvcc, not a regular C compiler.

How to setup Visual Studio and CUDA can be found in the CUDA Getting Started Guide for Microsoft Windows.

Can you help me, how to compile file with format .cu in nvcc?

This is covered in the copious documentation that comes with CUDA. If that seems overwhelming, you may want to try an introductory text on CUDA, e.g. the book “CUDA by Example”.

In the simplest form, you can compile a CUDA source file with nvcc like this:

nvcc -o [executable-file-name] [source-file-name]

where [source-file-name] has a .cu suffix.