Re: Question about glibmm/Glib::ustring::format
- From: "Waitman Gobble" <uzimac da3m0n8t3r com>
- To: uzimac da3m0n8t3r com
- Cc: "gtkmm-list gnome org" <gtkmm-list gnome org>
- Subject: Re: Question about glibmm/Glib::ustring::format
- Date: Sun, 9 Feb 2014 07:17:44 -0800
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>
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
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
+1.510-830-7975
--
Waitman Gobble
San Jose California USA
(510) 830-7975
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]