Re: terminate called after throwing an instance of 'Glib::FileError'

Hello Phong Cao,

1. I compiled and run your program. It started without an error.
2. I renamed the file now-playing.png so the program would not find it.
Then I got the same abrupt termination as you got.
3. I restored the file name, and started the program from another
directory. Then it also terminated with Glib::FileError. This is
probably what happened to you.

Gdk::Pixbuf::create_from_file("now-playing.png") searches for the file
in the current directory, which is the directory from where the program
was started. That's not necessarily the directory where the program's
executable file is stored.

You need to call a function that tells you where your executable is
stored (search path, not just filename). Unfortunately I don't know
which function is appropriate. Perhaps someone else knows?


sön 2011-06-19 klockan 02:56 -0400 skrev Phong Cao:
> Hello guys,
> I am trying to develop a music manager software using Gtkmm. I
> successfully compiled it but after running I received an error:
> terminate called after throwing an instance of 'Glib::FileError'
> ...and the program could not start.
> I tried to debug it in gdb and it said that the error occured at line
> 55 of file, which sets value for a cell that displays a
> Glib::RefPtr<Gdk::Pixbuf> (image type) :

> 55. row[l_colrec.l_icon] =
> Gdk::Pixbuf::create_from_file("now-playing.png");

> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org

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