On Sun, February 9, 2014 12:47 pm, Andrew Potter wrote: > On Sun, Feb 9, 2014 at 4:14 AM, Waitman Gobble <uzi...@da3m0n8t3r.com> > wrote: > >> Program received signal SIGABRT, Aborted. >> [Switching to Thread 803006400 (LWP 100327)] >> 0x0000000801e313ba in kill () from /lib/libc.so.7 >> (gdb) bt >> #0 0x0000000801e313ba in kill () from /lib/libc.so.7 >> #1 0x0000000801e30069 in abort () from /lib/libc.so.7 >> #2 0x00000008016ce7da in ?? () from /lib/libcxxrt.so.1 >> #3 0x000000080085de68 in Glib::ConvertError::throw_func(_GError*) () >> from /usr/local/lib/libglibmm-2.4.so.1 #4 0x000000080086ed2f in >> Glib::Error::throw_exception(_GError*) () >> from /usr/local/lib/libglibmm-2.4.so.1 #5 0x000000080087bcc2 in >> Glib::ustring::FormatStream::to_string() const () >> from /usr/local/lib/libglibmm-2.4.so.1 #6 0x0000000000401de0 in >> Glib::ustring::format<std::__1::ios_base& >> (std::__1::ios_base&), std::__1::__iom_t5, double>(std::__1::ios_base& ( >> const&)(std::__1::ios_base&), std::__1::__iom_t5 const&, double >> const&) ( a1=@0x401e50: {std::__1::ios_base &(std::__1::ios_base &)} >> 0x401e50 >> <std::__1::fixed(std::__1::ios_base&)>, a2=..., a3=@0x7fffffffd860: >> 3.1428571428571428) >> at /usr/local/include/glibmm-2.4/glibmm/ustring.h:1158 #7 >> 0x0000000000401696 in main () at testglib.cpp:9 >> (gdb) >> > > The code works fine for me, but I'm on Linux. > FormatStream::to_string() has plenty of #ifdefs so its not entirely > obvious what's happening. > > Can you catch the exception and print out the Glib::Error::what() ? > > > Thanks. > _______________________________________________ > gtkmm-list mailing list gtkmm-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtkmm-list > >
Thanks Andrew, that helps. I'm no c++ ace. #include <iostream> #include <iomanip> #include <glibmm.h> #include <glib.h> int main() { double value = 22.0 / 7.0; std::cout << value << std::endl; try { Glib::ustring test = Glib::ustring::format(std::fixed,std::setprecision(2),value); } catch (Glib::Error e) { std::cout << "oops " << e.what() << std::endl; } } # clang++ -o testglib `pkg-config --cflags --libs gtkmm-2.4` testglib.cpp /testglib 3.14286 oops Could not open converter from 'WCHAR_T' to 'UTF-8' Thank you, -- Waitman Gobble San Jose California USA +1.510-830-7975 -- Waitman Gobble San Jose California USA +1.510-830-7975 _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list