CUDA compile error

I am trying to compile examples from the book CUDA By Example. I am using a non-root account from a remote computer using terminal via SSH.

When I try to compile code I get the following errors:

/usr/bin/ld: /tmp/tmpxft_00002ebd_00000000-13_PassingParameters.o: undefined reference to symbol ‘pthread_cancel@@GLIBC_2.2.5
/usr/bin/ld: note: ‘pthread_cancel@@GLIBC_2.2.5’ is defined in DSO /lib64/ so try adding it to the linker command line
/lib64/ could not read symbols: Invalid operation

My first guess is that I have to link some kind of library to the “liker command line.” I have little knowledge about this so can someone please explain?