Error Compiling Application Opencv

I established Opencv with the following links;

1- ve

2 -



I wanted to try the examples in these links.

When I try to compile the sample application, I get an error like this:

After you write the “make” command;

[ 50%] Linking CXX executable DisplayImage
/usr/bin/ld: cannot find -lopencv_dep_cudart
collect2: error: ld returned 1 exit status
CMakeFiles/DisplayImage.dir/build.make:117: recipe for target ‘DisplayImage’ failed
make[2]: *** [DisplayImage] Error 1
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/DisplayImage.dir/all’ failed
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
Makefile:83: recipe for target ‘all’ failed
make: *** [all] Error 2

How can I solve this problem?
Thank you…

/usr/bin/ld: cannot find -lopencv_dep_cudart

Looks for linking your sample executable, the linker misses

It seems you’ve built OpenCv3.2.0 and you are trying to compile samples for OpenCv2.4.

I have no TX1 with me for checking, but the libraries and namespaces changed from opencv2 to opencv3.

What is your opencv include path ?

If you can find where is on your system, just type:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:path_to_your_opencvlib_directory


The environnement variable LD_LIBRARY_PATH holds the list of non standard paths for dynamic libraries. You just have to set it once.
Note that for running the executable, this also needs to be defined.


Please add following flag in CmakeList.txt



I faced the same issue when I was trying out the tutorials. I am using the inbuilt version of OpenCV (2.4). The following steps solved the issue for me:

Step 1: Put the code and the CMakeLists.txt file in a folder (code is same as in the tutorials). The executable is cv_hello. Now open the terminal from the folder and execute the following commands.

Step 2:


Step 3:


Step 4: