OpenCV GTK+2.x 错误-“未指定错误(该函数未实现..

时间:2023-02-28
本文介绍了OpenCV GTK+2.x 错误-“未指定错误(该函数未实现...)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照以下步骤安装了 OpenCV.尝试编译一个示例后,出现此错误:

I had installed OpenCV following these steps. After trying to compile one example, I got this error:

OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /home/nick/.Apps/opencv/modules/highgui/src/window.cpp, line 516
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/nick/.Apps/opencv/modules/highgui/src/window.cpp:516: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon 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

CMakeLists.txt

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.4)
project(threadTest)

find_package( OpenCV REQUIRED )


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -pthread")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "/home/nick/ClionProjects/threadTest")

set(SOURCE_FILES main.cpp)
add_executable(threadTest ${SOURCE_FILES})
target_link_libraries( threadTest ${OpenCV_LIBS} )

我该如何解决?

推荐答案

首先检查libgtk2.0-dev是否安装正确.如果您已安装 aptitude 包管理器,请运行以下命令:

First check whether libgtk2.0-dev is installed properly. If you have installed aptitude package manager, run the following:

sudo aptitude search libgtk2.0-dev

它应该像这样返回:

i  libgtk2.0-dev              - development files for the GTK+ library
p  libgtk2.0-dev:i386         - development files for the GTK+ library

您需要再次构建文件.找到您的 OpenCV 文件夹.创建一个新文件夹并将其命名为Release.进入这个文件夹.例如,

You need to build the files once again. Locate your OpenCV folder. Create a new folder and name it Release. Enter into this folder. For example,

cd /home/user_name/OpenCv
mkdir Release
cd Release

现在使用 CMake 使用以下命令构建:

Now build using CMake with following command:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON ..

记得在CMake的时候设置WITH_GTK=ON.

Remember to put WITH_GTK=ON during CMake.

在这一步之后,输入命令,

After this step, enter the command,

make
sudo make install

这应该可以解决您的问题.如果您破坏了 libgtk2.0-dev 的依赖项,请使用 aptitude 安装 libgtk2.0-dev 的新副本.

This should resolve your problem. If you have broken dependencies for libgtk2.0-dev, then install a fresh copy of libgtk2.0-dev using aptitude.

sudo aptitude install libgtk2.0-dev

这篇关于OpenCV GTK+2.x 错误-“未指定错误(该函数未实现...)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:如何在 Visual Studio 2010 中实现 Tesseract 与项目一起 下一篇:复制非矩形roi opencv

相关文章

最新文章