Ubuntu install and compile OpenCV3.4.0 fatal error: dynlink_nvcuvid.h: No such file or directory #include <dynlink_nv

Problems encountered

fatal error: dynlink_nvcuvid.h: No such file or directory #include <dynlink_nvcuvid.h>

Solution
Add: -dbuild_opencv_cudacodec=OFF

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TIFF=ON -DBUILD_opencv_cudacodec=OFF ..

sudo make -j12
sudo make install

Problems encountered

[ WARN:0] cvCreateFileCaptureWithPreference: backend FFMPEG doesn't support legacy API anymore.

Solution

install opencv3.4.0 

It must be 3.4.0, others 3.4 X is wrong
3.4.0 download address https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/3.4.0
Then install the extension package of OpenCV 3.4.0, download address, https://codeload.github.com/opencv/opencv_contrib/tar.gz/refs/tags/3.4.0

Read More: