I have Windows 7 x64, gtkmm 2.22 x86 and x64, TDM-GCC 4.9.2 x86 and x64, Eclipse Mars.2, and pkg-config installed as an Eclipse plugin. I have successfully compiled both x86 and x64 programs with this setup, but cannot get gtkmm 2.22 working as x86.
I have four build options, debug x64, debug x86, release x64, and release x86. Both x64 work flawlessly. However, when I try to build either x86, I get an error and it crashes.
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
It makes absolutely no sense. I have MINGW-HOME set properly and all environmental variables are set. The program even pretends to compile properly without any errors. It just breaks when it runs.
Please give a solution where I don't have to upgrade to gtk 3. I don't want to mess with installing all the crud I need to compile it; I just want something to work.
Here's my code.
#include <gtkmm.h>
#include <iostream>
using namespace std;
void button_clicked()
{
cout << "Howdy!" << endl;
}
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window main_window;
Gtk::Button button("Click here");
main_window.set_title("Eclipse");
main_window.set_border_width( 4 );
main_window.set_default_size( 200, 50 );
main_window.add( button );
button.show();
button.signal_clicked().connect( sigc::ptr_fun(button_clicked) );
Gtk::Main::run( main_window );
return 0;
}
Here are my build logs, which are nearly identical.
x86:
Info: Internal Builder is used for build
g++ -IC:/dev/gtkmm/include/gtkmm-2.4 -IC:/dev/gtkmm/lib/gtkmm-2.4/include -IC:/dev/gtkmm/include/atkmm-1.6 -IC:/dev/gtkmm/include/giomm-2.4 -IC:/dev/gtkmm/lib/giomm-2.4/include -IC:/dev/gtkmm/include/pangomm-1.4 -IC:/dev/gtkmm/lib/pangomm-1.4/include -IC:/dev/gtkmm/include/gtk-2.0 -IC:/dev/gtkmm/include/gdkmm-2.4 -IC:/dev/gtkmm/lib/gdkmm-2.4/include -IC:/dev/gtkmm/include/atk-1.0 -IC:/dev/gtkmm/include/glibmm-2.4 -IC:/dev/gtkmm/lib/glibmm-2.4/include -IC:/dev/gtkmm/include/glib-2.0 -IC:/dev/gtkmm/lib/glib-2.0/include -IC:/dev/gtkmm/include/sigc++-2.0 -IC:/dev/gtkmm/lib/sigc++-2.0/include -IC:/dev/gtkmm/include/cairomm-1.0 -IC:/dev/gtkmm/lib/cairomm-1.0/include -IC:/dev/gtkmm/include/pango-1.0 -IC:/dev/gtkmm/include/cairo -IC:/dev/gtkmm/include -IC:/dev/gtkmm/include/freetype2 -IC:/dev/gtkmm/include/libpng14 -IC:/dev/gtkmm/lib/gtk-2.0/include -IC:/dev/gtkmm/include/gdk-pixbuf-2.0 -O3 -Wall -c -fmessage-length=0 -mms-bitfields -o "src\\main.o" "..\\src\\main.cpp"
g++ -LC:/dev/gtkmm/lib -Lc:/devel/dist/win32/libpng-1.4.3-1/lib -o gtktest.exe "src\\main.o" -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-win32-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpng14 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-win32-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpng14 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
x64 [note: I didn't switch all the gtk directories to gtkmm64 yet (besides the linker ones which are the only difference), but they worked anyway because they're not compiled; irrelevant to the issue though]:
Info: Internal Builder is used for build
g++ -IC:/dev/gtkmm/include/gtkmm-2.4 -IC:/dev/gtkmm/lib/gtkmm-2.4/include -IC:/dev/gtkmm/include/atkmm-1.6 -IC:/dev/gtkmm/include/giomm-2.4 -IC:/dev/gtkmm/lib/giomm-2.4/include -IC:/dev/gtkmm/include/pangomm-1.4 -IC:/dev/gtkmm/lib/pangomm-1.4/include -IC:/dev/gtkmm/include/gtk-2.0 -IC:/dev/gtkmm/include/gdkmm-2.4 -IC:/dev/gtkmm/lib/gdkmm-2.4/include -IC:/dev/gtkmm/include/atk-1.0 -IC:/dev/gtkmm/include/glibmm-2.4 -IC:/dev/gtkmm/lib/glibmm-2.4/include -IC:/dev/gtkmm/include/glib-2.0 -IC:/dev/gtkmm/lib/glib-2.0/include -IC:/dev/gtkmm/include/sigc++-2.0 -IC:/dev/gtkmm/lib/sigc++-2.0/include -IC:/dev/gtkmm/include/cairomm-1.0 -IC:/dev/gtkmm/lib/cairomm-1.0/include -IC:/dev/gtkmm/include/pango-1.0 -IC:/dev/gtkmm/include/cairo -IC:/dev/gtkmm/include -IC:/dev/gtkmm/include/freetype2 -IC:/dev/gtkmm/include/libpng14 -IC:/dev/gtkmm/lib/gtk-2.0/include -IC:/dev/gtkmm/include/gdk-pixbuf-2.0 -O3 -Wall -c -fmessage-length=0 -mms-bitfields -o "src\\main.o" "..\\src\\main.cpp"
g++ -LC:/dev/gtkmm64/lib -Lc:/devel/dist/win64/libpng-1.4.3-1/lib -o gtktest.exe "src\\main.o" -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-win32-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpng14 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-win32-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpng14 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
And here is the Windows Error code:
Problem signature:
Problem Event Name: APPCRASH
Application Name: gtktest.exe
Application Version: 0.0.0.0
Application Timestamp: 00030000
Fault Module Name: libglibmm-2.4-1.dll
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 4ca2779e
Exception Code: 40000015
Exception Offset: 00031be1
OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033
Additional Information 1: da22
Additional Information 2: da22393e367e276867ed5498aa28f336
Additional Information 3: 8416
Additional Information 4: 8416a4494bdcce2298bd975b28950714
Thanks for any help. If I can't get this working I won't be able to develop any programs with user interfaces, because windows.h is too complicated and not cross platform, qt is too restrictive with its licensing, and gtk just won't work.
What I have tried:
I tried using regular mingw, which was a nuisance trying to install, and it turned out even worse. I tried upgrading tdm-gcc-32 to 5.1.0, but the results are exactly the same. I tried commenting out the namespace and the cout, same results. I converted it into a basic cmd Hello World program and it worked fine, but I want gtk so that does me no good except possibly narrow the problem.
I found a precompiled gtkmm 3.6 on Sourceforge. It sucks though. The point of getting precompiled is so I wouldn't have to do anything with it to make it work, but it has no pkg-config; I guess I am supposed to write it myself, except I have idea how to do that. Now everything is messed up and I am frustrated.