如何修复 gtkmm 警告:不推荐使用的声明
how to fix gtkmm warning : deprecated-declarations
如果没有编译器的警告,我无法运行 任何 程序(包括 gtkmm)。
如何解决这个问题?
(没有#pragma GCC 诊断忽略“-Wdeprecated-declarations”)
谢谢。
代码:
#include <gtkmm.h>
int main(){
}
命令(shell 编译脚本):
# /bin/sh
g++ main.cpp $(pkg-config --libs --cflags gtkmm-3.0)
./a.out
警告:
In file included from /usr/include/glibmm-2.4/glibmm/thread.h:48,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/timeval.h:38:42: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
38 | inline TimeVal(const GTimeVal& gtimeval);
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm/thread.h:48,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/timeval.h:39:53: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
39 | inline TimeVal& operator=(const GTimeVal& gtimeval);
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm/thread.h:48,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/timeval.h:104:49: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
104 | inline TimeVal::TimeVal(const GTimeVal& gtimeval)
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm/thread.h:48,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/timeval.h:111:44: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
111 | TimeVal::operator=(const GTimeVal& gtimeval)
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:139:52: warning: ‘GThreadFunctions’ is deprecated [-Wdeprecated-declarations]
139 | void thread_init(GThreadFunctions* vtable = nullptr);
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:55:34: note: declared here
55 | typedef struct _GThreadFunctions GThreadFunctions GLIB_DEPRECATED_TYPE_IN_2_32;
| ^~~~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:399:22: warning: ‘GStaticMutex’ is deprecated: Use 'GMutex' instead [-Wdeprecated-declarations]
399 | GStaticMutex* gobj() { return &gobject_; }
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:136:3: note: declared here
136 | } GStaticMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GMutex);
| ^~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:403:16: warning: ‘GStaticMutex’ is deprecated: Use 'GMutex' instead [-Wdeprecated-declarations]
403 | GStaticMutex gobject_;
| ^~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:136:3: note: declared here
136 | } GStaticMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GMutex);
| ^~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:525:25: warning: ‘GStaticRecMutex’ is deprecated: Use 'GRecMutex' instead [-Wdeprecated-declarations]
525 | GStaticRecMutex* gobj() { return &gobject_; }
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:152:33: note: declared here
152 | typedef struct _GStaticRecMutex GStaticRecMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex);
| ^~~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:529:19: warning: ‘GStaticRecMutex’ is deprecated: Use 'GRecMutex' instead [-Wdeprecated-declarations]
529 | GStaticRecMutex gobject_;
| ^~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:152:33: note: declared here
152 | typedef struct _GStaticRecMutex GStaticRecMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex);
| ^~~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:602:23: warning: ‘GStaticRWLock’ is deprecated: Use 'GRWLock' instead [-Wdeprecated-declarations]
602 | GStaticRWLock* gobj() { return &gobject_; }
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:193:31: note: declared here
193 | typedef struct _GStaticRWLock GStaticRWLock GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock);
| ^~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:606:17: warning: ‘GStaticRWLock’ is deprecated: Use 'GRWLock' instead [-Wdeprecated-declarations]
606 | GStaticRWLock gobject_;
| ^~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:193:31: note: declared here
193 | typedef struct _GStaticRWLock GStaticRWLock GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock);
| ^~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:787:24: warning: ‘GStaticPrivate’ is deprecated: Use 'GPrivate' instead [-Wdeprecated-declarations]
787 | GStaticPrivate* gobj() { return &gobject_; }
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:235:33: note: declared here
235 | typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate);
| ^~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:791:18: warning: ‘GStaticPrivate’ is deprecated: Use 'GPrivate' instead [-Wdeprecated-declarations]
791 | GStaticPrivate gobject_;
| ^~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:235:33: note: declared here
235 | typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate);
| ^~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:1090:59: warning: ‘GStaticPrivate’ is deprecated: Use 'GPrivate' instead [-Wdeprecated-declarations]
1090 | void* StaticPrivate_get_helper(GStaticPrivate *private_key);
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:235:33: note: declared here
235 | typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate);
| ^~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:1100:96: warning: ‘GStaticPrivate’ is deprecated: Use 'GPrivate' instead [-Wdeprecated-declarations]
1100 | void StaticPrivate_set_helper(GStaticPrivate *private_key, gpointer data, GDestroyNotify notify);
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:235:33: note: declared here
235 | typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate);
| ^~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm/binding.h:22,
from /usr/include/glibmm-2.4/glibmm.h:97,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/object.h:73:15: warning: ‘GParameter’ is deprecated [-Wdeprecated-declarations]
73 | GParameter* parameters;
| ^~~~~~~~~~
In file included from /usr/include/glib-2.0/gobject/gobject.h:26,
from /usr/include/glib-2.0/gobject/gbinding.h:29,
from /usr/include/glib-2.0/glib-object.h:23,
from /usr/include/glibmm-2.4/glibmm/value.h:24,
from /usr/include/glibmm-2.4/glibmm/error.h:22,
from /usr/include/glibmm-2.4/glibmm/thread.h:47,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/gobject/gparam.h:194:28: note: declared here
194 | typedef struct _GParameter GParameter GLIB_DEPRECATED_TYPE_IN_2_54;
| ^~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:105,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/date.h:261:27: warning: ‘GTime’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
261 | void set_time(GTime time);
| ^
In file included from /usr/include/glib-2.0/glib.h:43,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gdate.h:48:17: note: declared here
48 | typedef gint32 GTime GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:105,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/date.h:287:40: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
287 | void set_time(const GTimeVal& timeval);
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~~~~
In file included from /usr/include/gdkmm-3.0/gdkmm.h:28,
from /usr/include/gtkmm-3.0/gtkmm.h:92,
from main.cpp:3:
/usr/include/gdkmm-3.0/gdkmm/pixbufanimation.h:184:72: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
184 | Glib::RefPtr<PixbufAnimationIter> get_iter(const GTimeVal* start_time);
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
|
环境:
OS : Ubuntu 19.10
编译器:g++ 9.2.1
库:libgtkmm-3.0-dev 3.24.1
您可以通过使用 GCC 或 Clang 的 -isystem
标志而不是 -I
将来自库 headers 的警告静音。 (要在当前设置中执行此操作,您可能必须 运行 在 pkg-config --cflags
命令的输出中使用一些 sed
表达式。)
我在 gcc 中遇到了同样的错误,我可以通过添加 CFLAGS 来修复它:
CC = gcc
CFLAGS = -Wall -Wunused \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED
唯一对我有用的是编译器选项:
-Wno-deprecated-declarations
可能有点矫枉过正。
如果没有编译器的警告,我无法运行 任何 程序(包括 gtkmm)。
如何解决这个问题?
(没有#pragma GCC 诊断忽略“-Wdeprecated-declarations”)
谢谢。
代码:
#include <gtkmm.h>
int main(){
}
命令(shell 编译脚本):
# /bin/sh
g++ main.cpp $(pkg-config --libs --cflags gtkmm-3.0)
./a.out
警告:
In file included from /usr/include/glibmm-2.4/glibmm/thread.h:48,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/timeval.h:38:42: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
38 | inline TimeVal(const GTimeVal& gtimeval);
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm/thread.h:48,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/timeval.h:39:53: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
39 | inline TimeVal& operator=(const GTimeVal& gtimeval);
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm/thread.h:48,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/timeval.h:104:49: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
104 | inline TimeVal::TimeVal(const GTimeVal& gtimeval)
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm/thread.h:48,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/timeval.h:111:44: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
111 | TimeVal::operator=(const GTimeVal& gtimeval)
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:139:52: warning: ‘GThreadFunctions’ is deprecated [-Wdeprecated-declarations]
139 | void thread_init(GThreadFunctions* vtable = nullptr);
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:55:34: note: declared here
55 | typedef struct _GThreadFunctions GThreadFunctions GLIB_DEPRECATED_TYPE_IN_2_32;
| ^~~~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:399:22: warning: ‘GStaticMutex’ is deprecated: Use 'GMutex' instead [-Wdeprecated-declarations]
399 | GStaticMutex* gobj() { return &gobject_; }
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:136:3: note: declared here
136 | } GStaticMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GMutex);
| ^~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:403:16: warning: ‘GStaticMutex’ is deprecated: Use 'GMutex' instead [-Wdeprecated-declarations]
403 | GStaticMutex gobject_;
| ^~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:136:3: note: declared here
136 | } GStaticMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GMutex);
| ^~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:525:25: warning: ‘GStaticRecMutex’ is deprecated: Use 'GRecMutex' instead [-Wdeprecated-declarations]
525 | GStaticRecMutex* gobj() { return &gobject_; }
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:152:33: note: declared here
152 | typedef struct _GStaticRecMutex GStaticRecMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex);
| ^~~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:529:19: warning: ‘GStaticRecMutex’ is deprecated: Use 'GRecMutex' instead [-Wdeprecated-declarations]
529 | GStaticRecMutex gobject_;
| ^~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:152:33: note: declared here
152 | typedef struct _GStaticRecMutex GStaticRecMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex);
| ^~~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:602:23: warning: ‘GStaticRWLock’ is deprecated: Use 'GRWLock' instead [-Wdeprecated-declarations]
602 | GStaticRWLock* gobj() { return &gobject_; }
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:193:31: note: declared here
193 | typedef struct _GStaticRWLock GStaticRWLock GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock);
| ^~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:606:17: warning: ‘GStaticRWLock’ is deprecated: Use 'GRWLock' instead [-Wdeprecated-declarations]
606 | GStaticRWLock gobject_;
| ^~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:193:31: note: declared here
193 | typedef struct _GStaticRWLock GStaticRWLock GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock);
| ^~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:787:24: warning: ‘GStaticPrivate’ is deprecated: Use 'GPrivate' instead [-Wdeprecated-declarations]
787 | GStaticPrivate* gobj() { return &gobject_; }
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:235:33: note: declared here
235 | typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate);
| ^~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:791:18: warning: ‘GStaticPrivate’ is deprecated: Use 'GPrivate' instead [-Wdeprecated-declarations]
791 | GStaticPrivate gobject_;
| ^~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:235:33: note: declared here
235 | typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate);
| ^~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:1090:59: warning: ‘GStaticPrivate’ is deprecated: Use 'GPrivate' instead [-Wdeprecated-declarations]
1090 | void* StaticPrivate_get_helper(GStaticPrivate *private_key);
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:235:33: note: declared here
235 | typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate);
| ^~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/thread.h:1100:96: warning: ‘GStaticPrivate’ is deprecated: Use 'GPrivate' instead [-Wdeprecated-declarations]
1100 | void StaticPrivate_set_helper(GStaticPrivate *private_key, gpointer data, GDestroyNotify notify);
| ^
In file included from /usr/include/glib-2.0/glib.h:110,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/deprecated/gthread.h:235:33: note: declared here
235 | typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate);
| ^~~~~~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm/binding.h:22,
from /usr/include/glibmm-2.4/glibmm.h:97,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/object.h:73:15: warning: ‘GParameter’ is deprecated [-Wdeprecated-declarations]
73 | GParameter* parameters;
| ^~~~~~~~~~
In file included from /usr/include/glib-2.0/gobject/gobject.h:26,
from /usr/include/glib-2.0/gobject/gbinding.h:29,
from /usr/include/glib-2.0/glib-object.h:23,
from /usr/include/glibmm-2.4/glibmm/value.h:24,
from /usr/include/glibmm-2.4/glibmm/error.h:22,
from /usr/include/glibmm-2.4/glibmm/thread.h:47,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/gobject/gparam.h:194:28: note: declared here
194 | typedef struct _GParameter GParameter GLIB_DEPRECATED_TYPE_IN_2_54;
| ^~~~~~~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:105,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/date.h:261:27: warning: ‘GTime’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
261 | void set_time(GTime time);
| ^
In file included from /usr/include/glib-2.0/glib.h:43,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gdate.h:48:17: note: declared here
48 | typedef gint32 GTime GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~
In file included from /usr/include/glibmm-2.4/glibmm.h:105,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glibmm-2.4/glibmm/date.h:287:40: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
287 | void set_time(const GTimeVal& timeval);
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
| ^~~~~~~~
In file included from /usr/include/gdkmm-3.0/gdkmm.h:28,
from /usr/include/gtkmm-3.0/gtkmm.h:92,
from main.cpp:3:
/usr/include/gdkmm-3.0/gdkmm/pixbufanimation.h:184:72: warning: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
184 | Glib::RefPtr<PixbufAnimationIter> get_iter(const GTimeVal* start_time);
| ^
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glibmm-2.4/glibmm/thread.h:38,
from /usr/include/glibmm-2.4/glibmm.h:88,
from /usr/include/gtkmm-3.0/gtkmm.h:87,
from main.cpp:3:
/usr/include/glib-2.0/glib/gtypes.h:549:26: note: declared here
549 | typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
|
环境:
OS : Ubuntu 19.10
编译器:g++ 9.2.1
库:libgtkmm-3.0-dev 3.24.1
您可以通过使用 GCC 或 Clang 的 -isystem
标志而不是 -I
将来自库 headers 的警告静音。 (要在当前设置中执行此操作,您可能必须 运行 在 pkg-config --cflags
命令的输出中使用一些 sed
表达式。)
我在 gcc 中遇到了同样的错误,我可以通过添加 CFLAGS 来修复它:
CC = gcc
CFLAGS = -Wall -Wunused \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED
唯一对我有用的是编译器选项:
-Wno-deprecated-declarations
可能有点矫枉过正。