我按照这些步骤安装了 OpenCV。尝试编译一个示例后,我收到此错误:
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
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} )
我该如何解决?
原文由 Maxian Nicu 发布,翻译遵循 CC BY-SA 4.0 许可协议
首先检查libgtk2.0-dev是否安装正确。如果您已安装 aptitude 包管理器,请运行以下命令:
它应该像这样返回:
您需要再次构建文件。找到您的 OpenCV 文件夹。创建一个新文件夹并将其命名为 Release 。进入这个文件夹。例如,
现在使用 CMake 使用以下命令构建:
记得在 CMake 期间放
WITH_GTK=ON
。这一步之后,输入命令,
这应该可以解决您的问题。如果您破坏了 libgtk2.0-dev 的依赖关系,请使用 aptitude 安装新的 libgtk2.0-dev 副本。