My opencv in successfully installed in Ubuntu, but my example_cmake doesn't work

" CMake Error at CMakeLists.txt:1 (ocv_install_example_src):
Unknown CMake command “ocv_install_example_src”. "

When I was cmake . in the /home/fby/opencv-3.4.16/samples/cpp/example_cmake, Error came as above.
I don’t know how to solve it and anyhow my opencv is successfully install as “opencv --modversion” gives the correct result.
Can anybody help me with this ?

3.4.16 is far too old.
the current 4.11 version of that file no more contains the error line

opencv --modversion

what is that?

But I am working on ORBSLAM2, opencv4 doesn’t work in ORB2SLAM.

3.X.X is deadbeef, no more maintained, noone will care about fixing this. sorry for bad news.

you should see about fixing that instead.

if you want to get historical software to work, you should use all period-accurate tools (versions). that especially goes for the compiler/toolchain and cmake.

you can try modern tools too. I would expect that to be more of a challenge. of course the old stuff has its own issues, which may have been fixed or improved since, but the reality is that compatibility trumps bugs.

it’s like if you needed to read some punched cards, you could try to get a punched card reader to work on an iPhone, or you could try that with other technology from the same era, which was made to work together.