gpt4 book ai didi

c++11 - 弃用通知使用 GTKMM 和 C++11 进行构建

转载 作者:行者123 更新时间:2023-12-02 08:25:32 28 4
gpt4 key购买 nike

我正在尝试将 GTKMM 与一个使用 C++11 功能的项目一起使用。问题是显然 C++11 弃用了该语言的某些部分,而 GTKMM 似乎正在使用这些部分。

有什么方法可以去除这些消息,同时为我的代码保留有用的编译器警告?

Linux 上的编译器是 GCC 5.2。这些是我正在谈论的通知:

In file included from /usr/include/glibmm-2.4/glibmm/wrap.h:23:0,
from /usr/include/glibmm-2.4/glibmm/containerhandle_shared.h:26,
from /usr/include/glibmm-2.4/glibmm/arrayhandle.h:23,
from /usr/include/glibmm-2.4/glibmm.h:91,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from test.cpp:1:
/usr/include/glibmm-2.4/glibmm/objectbase.h:215:13: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
static std::auto_ptr<Threads::Mutex> extra_object_base_data_mutex;
^
In file included from /usr/include/c++/5.2.0/memory:81:0,
from /usr/include/glibmm-2.4/glibmm/objectbase.h:32,
from /usr/include/glibmm-2.4/glibmm/wrap.h:23,
from /usr/include/glibmm-2.4/glibmm/containerhandle_shared.h:26,
from /usr/include/glibmm-2.4/glibmm/arrayhandle.h:23,
from /usr/include/glibmm-2.4/glibmm.h:91,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from test.cpp:1:
/usr/include/c++/5.2.0/bits/unique_ptr.h:49:28: note: declared here template<typename> class auto_ptr;

如果编译器参数有问题,这里是 CMakeLists(从 OpenCV 项目中重用,如果文件中有问题请告知):

cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
list( APPEND CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS} -g -ftest-coverage -fprofile-arcs -libs")

project( interface )
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTKMM REQUIRED gtkmm-3.0)
include_directories(${GTKMM_INCLUDE_DIRS})
link_directories(${GTKMM_LIBRARY_DIRS})
add_definitions(${GTKMM_CFLAGS_OTHER})
add_executable( interface test.cpp )
target_link_libraries(interface ${GTKMM_LIBRARIES})

最佳答案

我们最近在 glibmm 中修复了这个问题: https://bugzilla.gnome.org/show_bug.cgi?id=748630#c11

因此,为您的构建修复它的最佳方法是尽可能更新您的 glibmm 和 gtkmm 版本。

关于c++11 - 弃用通知使用 GTKMM 和 C++11 进行构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32586881/

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