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

OpenCV GTK+2.x error - quot;Unspecified error (The function is not implemented...)quot;(OpenCV GTK+2.x 错误-“未指定错误(该函数未实现...))
本文介绍了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 错误-“未指定错误(该函数未实现...)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Bring window to front -gt; raise(),show(),activateWindow() don’t work(把窗户放在前面 -raise(),show(),activateWindow() 不起作用)
How to get a list video capture devices NAMES (web cameras) using Qt (crossplatform)? (C++)(如何使用 Qt(跨平台)获取列表视频捕获设备名称(网络摄像机)?(C++))
How to compile Qt as static(如何将 Qt 编译为静态)
C++ over Qt : Controlling transparency of Labels and Buttons(C++ over Qt:控制标签和按钮的透明度)
How to know when a new USB storage device is connected in Qt?(Qt如何知道新的USB存储设备何时连接?)
What is an event loop in Qt?(Qt 中的事件循环是什么?)