我正在尝试编译使用gtkmm和opencv的GTK2程序。我用命令行g ++尝试了它:
g++ main.cpp -o bla `pkg-config --cflags --libs gtkmm-2.4 opencv`
它会抛出与下面输出相同的错误。
我尝试使用cmake和CMakeLists.txt文件:
project (gtk-test)
cmake_minimum_required (VERSION 2.4)
find_package (PkgConfig REQUIRED)
pkg_check_modules (GTK2 REQUIRED gtk+-2.0)
include_directories (${GTK2_INCLUDE_DIRS})
link_directories (${GTK2_LIBRARY_DIRS})
add_executable (gtk-test main.c)
add_definitions (${GTK2_CFLAGS_OTHER})
target_link_libraries (gtk-test ${GTK2_LIBRARIES})
cmake。 &安培;&安培;使:
CMake Warning (dev) at CMakeLists.txt:6 (link_directories):
This command specifies the relative path
$GTKMM_LIBRARY_DIRS}
as a link directory.
Policy CMP0015 is not set: link_directories() treats paths relative to the
source dir. Run "cmake --help-policy CMP0015" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/alefveld/Downloads/gtkcv
[ 25%] Building CXX object CMakeFiles/bla.dir/MainWindow.cpp.o
In file included from /Users/alefveld/Downloads/gtkcv/MainWindow.cpp:1:
In file included from /Users/alefveld/Downloads/gtkcv/MainWindow.hpp:12:
In file included from /usr/local/include/gtkmm-2.4/gtkmm/window.h:7:
In file included from /usr/local/include/glibmm-2.4/glibmm.h:87:
In file included from /usr/local/include/glibmm-2.4/glibmm/thread.h:49:
In file included from /usr/local/include/glibmm-2.4/glibmm/error.h:23:
In file included from /usr/local/include/glibmm-2.4/glibmm/exception.h:25:
/usr/local/include/glibmm-2.4/glibmm/ustring.h:267:13: error: expected ';' at
end of declaration list
~ustring() noexcept;
^
;
/usr/local/include/glibmm-2.4/glibmm/ustring.h:881:48: warning: deleted function
definitions are a C++11 extension [-Wc++11-extensions]
FormatStream(const ustring::FormatStream&) = delete;
^
/usr/local/include/glibmm-2.4/glibmm/ustring.h:882:59: warning: deleted function
definitions are a C++11 extension [-Wc++11-extensions]
FormatStream& operator=(const ustring::FormatStream&) = delete;
^
/usr/local/include/glibmm-2.4/glibmm/ustring.h:894:18: error: expected ';' at
end of declaration list
~FormatStream() noexcept;
^
;
/usr/local/include/glibmm-2.4/glibmm/ustring.h:1273:45: warning: deleted
等等。我在这里失踪了什么?任何帮助都将永远受到赞赏。我如何一次编译Gtk / gtkmm和opencv?
答案 0 :(得分:1)
GTKmm和GTK是两回事。 GTKmm是GTK的C ++绑定,因此GTKmm依赖于GTK库。
对于CMake和GTKmm,只需查看using CMake with GTKmm上的官方维基页面。