gpt4 book ai didi

c++ - 更正 gtk、gtkmm 和 opencv 的 CMakeLists.txt 文件

转载 作者:行者123 更新时间:2023-11-28 05:47:49 24 4
gpt4 key购买 nike

我正在尝试编译一个使用 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 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?

最佳答案

GTKmm 和 GTK 是两个不同的东西。 GTKmm 是 GTK 的 C++ 绑定(bind),因此 GTKmm 依赖于 GTK 库。

对于 CMake 和 GTKmm,请查看 using CMake with GTKmm 上的官方维基页面。 .

关于c++ - 更正 gtk、gtkmm 和 opencv 的 CMakeLists.txt 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35879749/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com