Compiling an Opencv file some libraries are not found

When i tried this command

g++ -ggdb `pkg-config --cflags opencv` esempio.c `pkg-config --libs opencv`

to compile my " esempio.c" i get as result this:

/usr/bin/ld: cannot find -lcufft
/usr/bin/ld: cannot find -lnpps
/usr/bin/ld: cannot find -lnppi
/usr/bin/ld: cannot find -lnppc

but the libraries exist because when i go in /usr/local/cuda-6.5/lib i get:

libcublas_device.a libcudadevrt.a libcufft.so libcufftw.so.6.5 libcuinj32.so.6.5.14 libcurand_static.a libnppc.so libnppi.so.6.5 libnpps.so.6.5.14 stubs
libcublas.so libcudart.so libcufft.so.6.5 libcufftw.so.6.5.14 libculibos.a libcusparse.so libnppc.so.6.5 libnppi.so.6.5.14 libnpps_static.a
libcublas.so.6.5 libcudart.so.6.5 libcufft.so.6.5.14 libcufftw_static.a libcurand.so libcusparse.so.6.5 libnppc.so.6.5.14 libnppi_static.a libnvToolsExt.so
libcublas.so.6.5.14 libcudart.so.6.5.14 libcufft_static.a libcuinj32.so libcurand.so.6.5 libcusparse.so.6.5.14 libnppc_static.a libnpps.so libnvToolsExt.so.1
libcublas_static.a libcudart_static.a libcufftw.so libcuinj32.so.6.5 libcurand.so.6.5.14 libcusparse_static.a libnppi.so libnpps.so.6.5 libnvToolsExt.so.1.0.0

what can i do to solve it?

Try adding:

-L/usr/local/cuda-6.5/lib64

or:

-L/usr/local/cuda-6.5/lib

to your g++ compile command line:

g++ -ggdb -L/usr/local/cuda-6.5/lib64 pkg-config --cflags opencv esempio.c pkg-config --libs opencv

If that doesn’t work, then the opencv you are using is likely depending on versions of those libs other than the version that comes with CUDA 6.5

Yes,by using -L/usr/local/cuda-6.5/lib it works but now when i try to execute the file it gives me this error:

g++ -ggdb -L /usr/local/cuda-6.5/lib `pkg-config --cflags opencv` esempio.cpp `pkg-config --libs opencv` 

 ./a.out

OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /hdd/buildbot/slaves/slave_jetson_tk1/52-O4T-L4T/opencv/modules/highgui/src/window.cpp, line 483
terminate called after throwing an instance of 'cv::Exception'
  what():  /hdd/buildbot/slaves/slave_jetson_tk1/52-O4T-L4T/opencv/modules/highgui/src/window.cpp:483: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvNamedWindow
Aborted

so i tried to install ,again, the libraries and this is the result

sudo apt-get install libgtk2.0-dev pkg-configReading package lists... Done
Building dependency tree       
Reading state information... Done
pkg-config is already the newest version.
libgtk2.0-dev is already the newest version.

Why i get this error? What can i do?

I don’t think those are errors, you already have the packages, so it’s no surprise.

The previous message said:

OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) …

So now that you have installed libgtk2.0-dev and pkg-config, the next step is to re-run the cmake or configure script you used to build OpenCV, and then re-build OpenCV with GTK+ 2.x support. If you then ask for a detailed set of instructions for how to do that, I won’t be able to help you, but perhaps someone else can. Or you could try studying OpenCV docs and build recipes that others have placed on the web.