OpenCV GTK+2.x error - quot;Unspecified error (The function is not implemented...)quot;(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 错误-“未指定错误(该函数未实现...)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:OpenCV GTK+2.x 错误-“未指定错误(该函数未实现..
基础教程推荐
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01
- 运算符重载的基本规则和习语是什么? 2022-10-31
- C++,'if' 表达式中的变量声明 2021-01-01
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01
- 设计字符串本地化的最佳方法 2022-01-01