虚拟 noexcept(true) 错误:MinGW 和 gtkmm

virtual noexcept(true) errors: MinGW and gtkmm

为了使用 MinGW 在 Windows 上构建一个 //working// C++/gtkmm-3.0 应用程序,我已经奋斗了一个月。我终于设法让库、MinGW 和 Codeblocks 在 Windows XP (VirtualBox) 上运行。但是,当我尝试构建时,出现以下错误。

这些是最新版本的 gtkmm-3.0 和依赖项。我通过 MSYS2 获得了它们,但由于未知原因我无法在该环境中构建。因此,正如经常推荐的那样,我将它们复制到 MinGW /lib/include 目录,并确保 pkg-config 可以找到它们。那里一切都好(据说)。

这些问题显然不是我的代码引起的。我没有编写或修改 gtkmm。然而,我无法让这些消失。

值得一提的是,我最近收到与 "cannot find glib::ustring::ustring" 有关的错误,它决定停止抱怨,而是突然给我这些。如果之前的消息再次出现,我将 post 放在这里。

我开始觉得根本不值得在 Windows 上发布这个软件。

注意: 我得到了其中的 50 多个,都在 gtkmm-3.0 及其依赖库中,都来自 main 的第 1 行或第 2 行,并且都具有确切的同样的细节。我只会展示一些 space.

感兴趣的内容
-------------- Build: Debug in infiltrator (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -std=c++11 -Wall -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -std=c++11 -Wall -g -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Wl,-luuid -LC:/dev/MinGW/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -lz -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -lintl -std=c++11 -mms-bitfields -pthread -IC:/dev/MinGW/include/glibmm-2.4 -IC:/dev/MinGW/lib/glibmm-2.4/include -IC:/dev/MinGW/include/sigc++-2.0 -IC:/dev/MinGW/lib/sigc++-2.0/include -IC:/dev/MinGW/include/glib-2.0 -IC:/dev/MinGW/lib/glib-2.0/include -IC:/dev/MinGW/include/gtkmm-3.0 -IC:/dev/MinGW/lib/gtkmm-3.0/include -IC:/dev/MinGW/include/atkmm-1.6 -IC:/dev/MinGW/include/giomm-2.4 -IC:/dev/MinGW/lib/giomm-2.4/include -IC:/dev/MinGW/include/pangomm-1.4 -IC:/dev/MinGW/lib/pangomm-1.4/include -IC:/dev/MinGW/include/gtk-3.0 -IC:/dev/MinGW/include/cairomm-1.0 -IC:/dev/MinGW/lib/cairomm-1.0/include -IC:/dev/MinGW/include/gdk-pixbuf-2.0 -IC:/dev/MinGW/include/gdkmm-3.0 -IC:/dev/MinGW/lib/gdkmm-3.0/include -IC:/dev/MinGW/include/atk-1.0 -IC:/dev/MinGW/include/pango-1.0 -IC:/dev/MinGW/include/cairo -IC:/dev/MinGW/include/pixman-1 -IC:/dev/MinGW/include -I/mingw32/include/freetype2 -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -IC:/dev/MinGW/include/freetype2 -IC:/dev/MinGW/include/libpng16 -IC:/dev/MinGW/include/harfbuzz -Iinclude -IC:\dev\MinGW\include -c "C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp" -o obj\Debug\main.o
In file included from C:/dev/MinGW/include/pangomm-1.4/pangomm/fontset.h:33:0,
                 from C:/dev/MinGW/include/pangomm-1.4/pangomm/context.h:37,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/widget.h:32,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/actiongroup.h:29,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/application.h:32,
                 from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:2:
C:/dev/MinGW/include/pangomm-1.4/pangomm/font.h:98:11: error: looser throw specifier for 'virtual Pango::Font::~Font()'
In file included from C:/dev/MinGW/include/glibmm-2.4/glibmm/binding.h:23:0,
                 from C:/dev/MinGW/include/glibmm-2.4/glibmm.h:96,
                 from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:1:
C:/dev/MinGW/include/glibmm-2.4/glibmm/object.h:117:11: error:   overriding 'virtual Glib::Object::~Object() noexcept (true)'
In file included from C:/dev/MinGW/include/pangomm-1.4/pangomm/context.h:37:0,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/widget.h:32,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/actiongroup.h:29,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/application.h:32,
                 from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:2:
C:/dev/MinGW/include/pangomm-1.4/pangomm/fontset.h:81:11: error: looser throw specifier for 'virtual Pango::Fontset::~Fontset()'
In file included from C:/dev/MinGW/include/glibmm-2.4/glibmm/binding.h:23:0,
                 from C:/dev/MinGW/include/glibmm-2.4/glibmm.h:96,
                 from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:1:
C:/dev/MinGW/include/glibmm-2.4/glibmm/object.h:117:11: error:   overriding 'virtual Glib::Object::~Object() noexcept (true)'
In file included from C:/dev/MinGW/include/pangomm-1.4/pangomm/fontfamily.h:34:0,
                 from C:/dev/MinGW/include/pangomm-1.4/pangomm/fontmap.h:36,
                 from C:/dev/MinGW/include/pangomm-1.4/pangomm/context.h:38,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/widget.h:32,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/actiongroup.h:29,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/application.h:32,
                 from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:2:
C:/dev/MinGW/include/pangomm-1.4/pangomm/fontface.h:81:11: error: looser throw specifier for 'virtual Pango::FontFace::~FontFace()'
In file included from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/widget.h:41:0,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/actiongroup.h:29,
                 from C:/dev/MinGW/include/gtkmm-3.0/gtkmm/application.h:32,
                 from C:\Documents and Settings\Jason\Desktop\infiltrator\main.cpp:2:
C:/dev/MinGW/include/gtkmm-3.0/gtkmm/buildable.h:107:11: error: looser throw specifier for 'virtual Gtk::Buildable::~Buildable()'
Process terminated with status 1 (0 minute(s), 6 second(s))
50 error(s), 0 warning(s) (0 minute(s), 6 second(s))

除了 gtkmm.

之外,在 Windows 上构建的其他稳定的、工作的项目和库似乎会弹出此类错误消息。

我最好的猜测 是我忘记了一些编译器标志、设置或构建过程中其他非常明显的步骤。赶紧提醒一下reader我在CodeBlocks(13.14),所以那个build命令不是我自己写的


请求的信息 mingw32-g++.exe --version

mingw32-g++.exe (tdm-1) 4.7.1

这是与 CodeBlocks 13.14 捆绑在一起的版本。

...

我会赶紧提醒大家,我没有编写 gtkmm 或其依赖项的任何方面,这是所有这些错误的来源。此外,这是一个完全稳定的版本,而不是测试版或开发快照。其次,在我的 Linux 构建中,此完全相同的代码使用完全相同版本的库

也就是说,这是来自所请求位置的完整代码行。

C:/dev/MinGW/include/glibmm-2.4/glibmm/object.h,第 117 行

virtual ~Object() noexcept; //It should only be deleted by the callback.

C:/dev/MinGW/include/pangomm-1.4/pangomm/font.h,第 98 行

virtual ~Font();

你的 g++ 版本对于这段代码来说太旧了:4.7.x 有一个半生不熟的方法 与显式和隐式异常规范的协调 在继承的成员函数之间,在本例中是在虚拟函数之间 Glib::ObjectPango::Font.

的析构函数

您至少需要升级到 GCC 4.8.1 - 这恰好是 MinGW 的最新稳定版本。你可以得到最新的 Windows 来自 TDM 的 GCC 端口。最新的 有 5.1

P.S。我有点怀疑你是否有 glibmm-2.4pangomm-1.4 的构建真正同步。我有 根据我的 linux 发行版 (Ubuntu 15.04),这些包的来源都是官方的,我查询的样本问题声明的行号与你的不同,它们都没有 noexcept 规范肯定会避免障碍。