not able to compile sdk examples after installation

i just finished installing CUDA toolkit v2.2 and SDK.When i try to compile the sample codes in the SDK on UBUNTU v 8.10, i am getting the following error

shashwat@mig8gb3-desktop:~/NVIDIA_CUDA_SDK$ make
make[1]: Entering directory /home/shashwat/NVIDIA_CUDA_SDK/common' make[1]: g++: Command not found make[1]: *** [obj/release/bank_checker.cpp.o] Error 127 make[1]: Leaving directory /home/shashwat/NVIDIA_CUDA_SDK/common’
make: *** [lib/] Error 2

also i am not able to get version of nvcc by running the command

#nvcc --version

please help.
thanking you in advance.

sudo apt-get install build-essential


Hi flankershasha,

This might sound obvious, but have you installed g++? :)


i tried this but it says

Reading package lists… Done

Building dependency tree

Reading state information… Done

E: Couldn’t find package build-essential

how do i install build-essential??

please help

Apparently you’re missing some ubuntu repositories.

Check your settings->repositories settings in your synaptic package manager.


first try to run “sudo apt-get update”

then install the build-essential

I have some other problems,

when i compile a simple SDK example the deviceQuery.cpp

i gives me error cutil,h not found

i changed the include <cutil.h> to e </home/bibrak/NVIDIA_CUDA_SDK/common/inc/cutil.h>
same i did for the dynamic library.

now it gives the error

bibrak@biebo-laptop:~/NVIDIA_CUDA_SDK/projects/deviceQuery$ nvcc -o dev deviceQuery.cpp
/tmp/tmpxft_000021ff_00000000-1_deviceQuery.o: In function main': deviceQuery.cpp:(.text+0x427): undefined reference to cutCheckCmdLineFlag’
collect2: ld returned 1 exit status

help me

Make sure you are linking against the cutil library (libcutil.a) located in /home/bibrak/NVIDIA_CUDA_SDK/lib/


I think your problem is that your nvcc installation is not being able to find the CUDA SDK include and library directories. This is probably a configuration error (sorry).

I’d suggest you try looking into the way you installed the CUDA SDK (i.e. did you install in the default location?) and try getting a small program which just includes <cuda.h> to work without having to tinker with the program’s include directives.

Alternatively, you can try playing with the -I (that’s a capital “i”) and -L compiler flags, in order to point the compiler to the directories where the CUDA SDK header and libraries are located in your filesystem.

Best regards,


An where r these flags located,
or in simple words what to do
nvcc -I ??? -L ??? -o devQ deviceQuery

and thanks for the help

Well, it depends on the location your CUDA SDK was installed. In my case, that would be /usr/local/cuda/include for the -I flag and /usr/local/cuda/lib for the -L flag, but again, I get these set by nvcc automatically.

Best regards,