error C3861: 'cudaFree': identifier not found

I just start to use CUDA and I tried to do some example from this book"cuda by example…".
this example in in page 25 of the book and I exactly copy and past it to my main.cpp but I got lots of error like;
error C3861: ‘cudaMemcpy’: identifier not found
error C2065: ‘threadIdx’ : undeclared identifier

this is the code:

#include “book.h”

global void add( int a, int b, int *c ) {
c = a + b;
int main( void ) {
int c;
int dev_c;
HANDLE_ERROR( cudaMalloc( (void
)&dev_c, sizeof(int) ) );

add<<<1,1>>>( 2, 7, dev_c );

HANDLE_ERROR( cudaMemcpy( &c, dev_c, sizeof(int),cudaMemcpyDeviceToHost ) );
printf( "2 + 7 = %d\n", c );
HANDLE_ERROR( cudaFree( dev_c ) );

return 0;


I would appreciate you if help me. or if some one can give a simple program that can help me to start learning CUDA, I really appreciate that.

You ahve to include the file book.h provided with sample codes.