# error in CUDA program

**URL:** <https://forums.developer.nvidia.com/t/error-in-cuda-program/7391>\
**Category:** CUDA Programming and Performance\
**Created:** [January 25, 2009, 6:23pm UTC](https://forums.developer.nvidia.com/t/error-in-cuda-program/7391 "2009-01-25T18:23:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devadam4](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@devadam4](https://forums.developer.nvidia.com/u/devadam4)\
**Post date:** [January 25, 2009, 6:23pm UTC](https://forums.developer.nvidia.com/t/error-in-cuda-program/7391/1 "2009-01-25T18:23:20Z")

</div>

hi. i m new in cuda and tried to write a simple .c extension code even copy from a page: ) . but i get errormessage on “ **global** ” and \<\<\<…\>\>\> part. also get error message like “threadIdx undefined”. i was include cuda.h only. i used visual studio 2005 to compile it. what is the problem with this?

also CUDA has an emulator on CPU. my graphic card does not multi-core so i must run CUDA programs on CPU. but how i differentiate it run on CPU or GPU.

i need your helps friend.

thanks!

---

<div class="post-metadata">

**Author:** ![ismailfaruqi](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/ismailfaruqi/32/12043_2.png) [@ismailfaruqi](https://forums.developer.nvidia.com/u/ismailfaruqi)\
**Post date:** [January 25, 2009, 6:43pm UTC](https://forums.developer.nvidia.com/t/error-in-cuda-program/7391/2 "2009-01-25T18:43:21Z")

</div>

> [@](#):
>
> hi. i m new in cuda and tried to write a simple .c extension code even copy from a page: ) . but i get errormessage on “ **global** ” and \<\<\<…\>\>\> part. also get error message like “threadIdx undefined”. i was include cuda.h only. i used visual studio 2005 to compile it. what is the problem with this?
> 
> also CUDA has an emulator on CPU. my graphic card does not multi-core so i must run CUDA programs on CPU. but how i differentiate it run on CPU or GPU.
> 
> i need your helps friend.
> 
> thanks!

it looks like that you use normal c++ compiler instead of nvcc. Maybe you can check your build rule…

---

<div class="post-metadata">

**Author:** ![devadam4](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@devadam4](https://forums.developer.nvidia.com/u/devadam4)\
**Post date:** [January 25, 2009, 7:58pm UTC](https://forums.developer.nvidia.com/t/error-in-cuda-program/7391/3 "2009-01-25T19:58:36Z")

</div>

> [@](#):
>
> it looks like that you use normal c++ compiler instead of nvcc. Maybe you can check your build rule…

i build CUDA and i could run by Visual Studio. and another problem occured. i wanted to test runnig thread by writing thread number to the screen but now error became from printf function. i also tried to use cout function but both of them failed. is there a different function to print on the screen something

one more question i set up cuda sdk and cuda tookit (not driver because my graphic card is not support cuda i try to use cuda on cpu). i have read that nvcc is in tookit but i can t found it how can i get and use it
