Re: Question about glibmm/Glib::ustring::format

On Sun, February 9, 2014 6:15 am, Waitman Gobble wrote:

On Sun, February 9, 2014 12:47 pm, Andrew Potter wrote:

On Sun, Feb 9, 2014 at 4:14 AM, Waitman Gobble <uzimac da3m0n8t3r com>

Program received signal SIGABRT, Aborted.
[Switching to Thread 803006400 (LWP 100327)]
0x0000000801e313ba in kill () from /lib/
(gdb) bt
#0  0x0000000801e313ba in kill () from /lib/
#1  0x0000000801e30069 in abort () from /lib/
#2  0x00000008016ce7da in ?? () from /lib/
#3  0x000000080085de68 in Glib::ConvertError::throw_func(_GError*) ()
from /usr/local/lib/ #4  0x000000080086ed2f in
Glib::Error::throw_exception(_GError*) ()
from /usr/local/lib/ #5  0x000000080087bcc2 in
Glib::ustring::FormatStream::to_string() const ()
from /usr/local/lib/ #6  0x0000000000401de0 in
(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 &)}
<std::__1::fixed(std::__1::ios_base&)>, a2=..., a3= 0x7fffffffd860:
at /usr/local/include/glibmm-2.4/glibmm/ustring.h:1158 #7
0x0000000000401696 in main () at testglib.cpp:9

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() ?

gtkmm-list mailing list gtkmm-list gnome org

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 =
} catch (Glib::Error e) {
std::cout << "oops " << e.what() << std::endl;


# clang++ -o testglib `pkg-config --cflags --libs gtkmm-2.4` testglib.cpp

oops Could not open converter from 'WCHAR_T' to 'UTF-8'

Thank you,

Waitman Gobble
San Jose California USA

Waitman Gobble
San Jose California USA

gtkmm-list mailing list gtkmm-list gnome org

I believe this program is fixed by changing the 'USES' line in the glib20
port Makefile on FreeBSD.. add wchar_t

USES=gettext gmake iconv:wchar_t pathfix pkgconfig shebangfix perl5

seems to solve the problem,

Thanks for your help tracking this down.

Waitman Gobble
San Jose California USA

Waitman Gobble
San Jose California USA
(510) 830-7975

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]