OpenCV's namedWindow is not implemented

When I run my C++ code, I get this error:

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.1.0) /home/me/opencv/modules/highgui/src/window.cpp:610: 
error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, 
GTK+ 2.x or Cocoa 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'

So then I went ahead and ran this command:

sudo apt-get install libgtk2.0-dev pkg-config -y

After re-running cmake, the same error persists.

I have all of the necessary imports:

#include <iostream>
#include <cstdio>
#include <iomanip>
#include <opencv2/opencv.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>

This is the line of code that is throwing the error:

cv::namedWindow("input video", cv::WINDOW_NORMAL);

let’s hope, you did a proper make && make install after that.

can you show us the cmake console output ? it’s rather long, but if there are problems, they will show up there

also, 4.1.0 is quite outdated, rather throw it away, and get latest (4.6.0) from github

crosspost: c++ - OpenCV's namedWindow is not implemented - Stack Overflow