error C2065: 'blockIdx' : undeclared identifier

Hi Experts,

           I have edited the template project in SDK. I just deleted all those things in the template and created my own program.

In which i declared the kernels in .h file, and defined it in .cu file.I also called those kernels from some other host function in the same .cu file.
But while compiling it in VS2008 i got error C2065: ‘blockIdx’ : undeclared identifier error. not only blockIdx,but also blockDim, threadIdx shows as undeclared identifiers.

i think i am missing some header files or somethings.

plz help me to solve this External Image

That is usually a sign that you are compiling device code with the host compiler and not nvcc (or that you are supplying device code in file which doesn’t have .cu as an extension).

It might be a good time to read some documentation.

Thank you Mr.avidday,

Ya i am compiling the device code also with VS2008 only. External Media

i have installed CUDA toolkit and SDK.But i can’t find nvcc any where… <img src=‘http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/crying.gif’ class=‘bbc_emoticon’ alt=‘:’(’ />

Where i can get this compiler?

Note: i dont have any GPU in my PC now. Is it a problem? External Media

Thank you Mr.avidday,

Ya i am compiling the device code also with VS2008 only. External Media

i have installed CUDA toolkit and SDK.But i can’t find nvcc any where… <img src=‘http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/crying.gif’ class=‘bbc_emoticon’ alt=‘:’(’ />

Where i can get this compiler?

Note: i dont have any GPU in my PC now. Is it a problem? External Media

Thank you Mr.avidday,

Ya i am compiling the device code also with VS2008 only. External Media

i have installed CUDA toolkit and SDK.But i can’t find nvcc any where… <img src=‘http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/crying.gif’ class=‘bbc_emoticon’ alt=‘:’(’ />

Where i can get this compiler?

Note: i dont have any GPU in my PC now. Is it a problem? External Media

Thanks in Advance,

karguvel

It should be in the CUDA toolkit. I think it is time you read this pdf.

ya, Thank you Mr.avidday,

It is really useful for me.I have also read some other documents. I have changed the Custom Build property of .cu files in VS2008 so that it first compiled by nvcc compiler.

When I compile the .cu files with nvcc compiler it doesn’t show any error.But when i compile the .cpp file (In which the host fun in .cu file called) with C/C++ compiler it shows some errors.

Its shows the kernel calls

             Assignvaluekernel <<<blocknos,threadnos>>> (D_A);    as

syntax error : ‘<’

(All those kernel called from host functions in .cu files only)

Any Ideas? (!)

k.Sorry its my mistake. I have solved it. K. Thank you Mr.avidday External Media