# Error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support

**URL:** <https://forum.opencv.org/t/error-2-unspecified-error-the-function-is-not-implemented-rebuild-the-library-with-windows-gtk-2-x-or-cocoa-support/14512>\
**Category:** Uncategorized\
**Tags:** programming\
**Created:** [September 11, 2023, 2:05pm UTC](https://forum.opencv.org/t/error-2-unspecified-error-the-function-is-not-implemented-rebuild-the-library-with-windows-gtk-2-x-or-cocoa-support/14512 "2023-09-11T14:05:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Apfl](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Apfl](https://forum.opencv.org/u/Apfl)\
**Post date:** [September 11, 2023, 2:05pm UTC](https://forum.opencv.org/t/error-2-unspecified-error-the-function-is-not-implemented-rebuild-the-library-with-windows-gtk-2-x-or-cocoa-support/14512/1 "2023-09-11T14:05:05Z")

</div>

I am trying to run a simple face detection on an ARMs target. I managed to cross compile all libraries and my source code but when executing on the target i get this error:

> terminated call after throwing an isntance of ‘cv::Exception’ what(): OpenCV(4.8.0-dev) /home/…/highgui/src/window.cpp:1272 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 ‘cvShowImage’

I read on a defferent entry that reinstalling python-opencv with pip solved the problem. Since i am on a ARMs target, thats not an option. I am also not sure if the opencv\_python is inckuded in the normal opencv source ([GitHub - opencv/opencv: Open Source Computer Vision Library](https://github.com/opencv/opencv)) ?

Thank you for help

----\> Code

> #include\<opencv2/imgcodecs.hpp\>  
> #include\<opencv2/highgui.hpp\>  
> #include\<opencv2/imgproc.hpp\>  
> #include\<opencv2/objdetect.hpp\>  
> #include  
> using namespace std;  
> using namespace cv;  
> /_void main() {  
> string path = “chando.jpg”;  
> Mat img = imread(path);  
> imshow(“Frame”, img);  
> waitKey(0);  
> }_/  
> int main(int argc, char \*\*argv) {  
> VideoCapture video(3);  
> CascadeClassifier facedetect;  
> Mat img;  
> facedetect.load(“haarcascade\_frontalface\_default.xml”);  
> while (true) {  
> video.read(img);  
> vector faces;  
> facedetect.detectMultiScale(img, faces, 1.3, 5);  
> cout \<\< faces.size() \<\< endl;  
> for (int i = 0; i \< faces.size(); i++) {  
> rectangle(img, faces[i].tl(), faces[i].br(), Scalar(50, 50, 255), 3);  
> rectangle(img, Point(0,0), Point(250,70), Scalar(50, 50, 255), FILLED);  
> putText(img, to\_string(faces.size())+" Face Found", Point(10, 40), FONT\_HERSHEY\_DUPLEX, 1, Scalar(255, 255, 255), 1);  
> }  
> imshow(“Frame”, img);  
> waitKey(1);  
> }  
> return 0;  
> }

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [September 11, 2023, 3:04pm UTC](https://forum.opencv.org/t/error-2-unspecified-error-the-function-is-not-implemented-rebuild-the-library-with-windows-gtk-2-x-or-cocoa-support/14512/2 "2023-09-11T15:04:33Z")

</div>

> [@Apfl](#):
>
> I read on a defferent entry that reinstalling python-opencv with pip solved the problem.

no, unfortunately not so. how would any python install change your c++ code ?

> [@Apfl](#):
>
> I am also not sure if the opencv\_python is inckuded in the normal opencv source

yes it is, look at modules/cv2 (it’s _generated_ from c++ headers …)  
but again, looking at python wont help at all, if you’re doing c++

so, you do not have any gui builtin atm, bc. it could not find _arm compiled_ gtk or qt libs at compile time of the libs.

for now, maybe just save the image to disk, and use an external viewer to visualize, then find out, how to cross-compile qt for arm …

---

<div class="post-metadata">

**Author:** ![Apfl](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Apfl](https://forum.opencv.org/u/Apfl)\
**Post date:** [September 12, 2023, 7:52am UTC](https://forum.opencv.org/t/error-2-unspecified-error-the-function-is-not-implemented-rebuild-the-library-with-windows-gtk-2-x-or-cocoa-support/14512/3 "2023-09-12T07:52:37Z")

</div>

okay that makes sense. I dont really need to display the image somewhere. I just need to write to the console if a face is detected. Would that be possible ?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [September 12, 2023, 7:55am UTC](https://forum.opencv.org/t/error-2-unspecified-error-the-function-is-not-implemented-rebuild-the-library-with-windows-gtk-2-x-or-cocoa-support/14512/4 "2023-09-12T07:55:23Z")

</div>

sure, just `cout` what you send to `putText()` now

---

<div class="post-metadata">

**Author:** ![Apfl](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Apfl](https://forum.opencv.org/u/Apfl)\
**Post date:** [September 15, 2023, 1:13pm UTC](https://forum.opencv.org/t/error-2-unspecified-error-the-function-is-not-implemented-rebuild-the-library-with-windows-gtk-2-x-or-cocoa-support/14512/5 "2023-09-15T13:13:51Z")

</div>

So after i removed “imshow” it still doesnt work with the same error message do you have any ideas ?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [September 15, 2023, 4:59pm UTC](https://forum.opencv.org/t/error-2-unspecified-error-the-function-is-not-implemented-rebuild-the-library-with-windows-gtk-2-x-or-cocoa-support/14512/6 "2023-09-15T16:59:21Z")

</div>

waitKey() has to go as well

---

<div class="post-metadata">

**Author:** ![Apfl](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Apfl](https://forum.opencv.org/u/Apfl)\
**Post date:** [September 18, 2023, 6:58am UTC](https://forum.opencv.org/t/error-2-unspecified-error-the-function-is-not-implemented-rebuild-the-library-with-windows-gtk-2-x-or-cocoa-support/14512/7 "2023-09-18T06:58:18Z")

</div>

Its running now! Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Fidel\_H](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/fidel_h/32/10565_2.png) [@Fidel\_H](https://forum.opencv.org/u/Fidel_H)\
**Post date:** [May 28, 2024, 7:12pm UTC](https://forum.opencv.org/t/error-2-unspecified-error-the-function-is-not-implemented-rebuild-the-library-with-windows-gtk-2-x-or-cocoa-support/14512/8 "2024-05-28T19:12:36Z")

</div>

For anyone wandering about this, I fixed the issue by installing said packages and re-building **the library** , not my project, it then worked just fine 👍
