virtual noexcept(true) errors: MinGW and gtkmm

こ雲淡風輕ζ 提交于 2019-12-11 11:13:13

问题


I've been fighting for a month solid to build a //working// C++/gtkmm-3.0 application on Windows with MinGW. I finally managed to get the libraries, MinGW, and Codeblocks to get along on Windows XP (VirtualBox). However, when I try to build, I get the following errors.

These are the most recent versions of gtkmm-3.0 and dependencies. I got them via MSYS2, though I cannot build in that environment for reasons yet unknown. So, as is oft recommended, I copied them over to the MinGW /lib and /include directories, and ensured pkg-config could find them. All's well there (allegedly).

These problems are not originating from my code, obviously. I didn't write or modify gtkmm. Yet, I can't get these to go away.

It is worth mentioning that I was last getting errors relating to "cannot find glib::ustring::ustring", and it decided to stop whining about that and give me these out of the blue instead. If the earlier messages ever show up again, I'll post them here.

I'm beginning to think it isn't worth releasing this software on Windows at all.

NOTE: I am getting over 50 of these, all in gtkmm-3.0 and its dependency libraries, all originating from line 1 or 2 of main, and all with the exact same details. I'll show only a few in interest of 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))

This type of error message seems to pop up with other stable, working projects and library being built on Windows, aside from gtkmm.

My best guess is that I forgot some compiler flag, setting, or other bright-blazingly obvious step in the build process. I will hasten to remind the reader that I am on CodeBlocks (13.14), so I didn't write that build command myself.


Requested Info mingw32-g++.exe --version

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

This is the version that came bundled with CodeBlocks 13.14.

...

I will hasten to remind everyone that I didn't write any aspect of gtkmm or its dependencies, which is where all of these errors are originating. Also, this is a fully stable version, NOT a beta or development snapshot. Second, this exact same code is working with the exact same versions of the library on my Linux build.

That said, here are the complete lines of code from the requested locations.

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

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

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

virtual ~Font();


回答1:


Your g++ version is too old for this code: 4.7.x had a half-baked way with the reconciliation of explicit and implied exception specifications between inherited member functions, as in this case between the virtual destructor of Glib::Object and that of Pango::Font.

You need to upgrade to at least GCC 4.8.1 - which happens to be the latest stable version from MinGW. You can get well up-to-date Windows port of GCC from TDM. Latest there is 5.1

P.S. I am a little suspicious as to whether you have builds of glibmm-2.4 and pangomm-1.4 that are really in sync. I have the sources of these packages both official per my linux distro (Ubuntu 15.04), and the line numbers of the specimen problem declarations that I enquired about are different from yours and neither of them has a noexcept specification which certainly avoids the snag.



来源:https://stackoverflow.com/questions/32854765/virtual-noexcepttrue-errors-mingw-and-gtkmm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!