Thank you guys for the responses!<div><br></div><div>I am not sure why this happened but when I clicked on the executable file the program ran. However, when I started it using Terminal, the program got error again. Anyway I think I just started it directly then...</div>
<div><br></div><div>BTW, does anyone know how to create a Gtk::Button that contains Stock image. In other words, do you know how to create a GtkStockButton without label?</div><div><br><div class="gmail_quote">On Sun, Jun 19, 2011 at 12:31 PM, Bastien Durel <span dir="ltr"><<a href="mailto:bastien@durel.org">bastien@durel.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">Le dimanche 19 juin 2011 à 13:31 +0200, Kjell Ahlstedt a écrit :<br>
[...]<br>
><br>
</div><div class="im">> Gdk::Pixbuf::create_from_file("now-playing.png") searches for the file<br>
> in the current directory, which is the directory from where the program<br>
> was started. That's not necessarily the directory where the program's<br>
> executable file is stored.<br>
><br>
> You need to call a function that tells you where your executable is<br>
> stored (search path, not just filename). Unfortunately I don't know<br>
> which function is appropriate. Perhaps someone else knows?<br>
><br>
</div><div><div></div><div class="h5">Hello,<br>
<br>
You may play with these functions :<br>
<a href="http://developer.gnome.org/glibmm/unstable/group__MiscUtils.html" target="_blank">http://developer.gnome.org/glibmm/unstable/group__MiscUtils.html</a><br>
<br>
You may see in argv[0] if the program was launched with a path<br>
(./debug/foo), and then use build_path & others to construct your image<br>
path name. Using find_program_in_path will help you if the user lauched<br>
it from nowhere because it's in the path.<br>
Using get_(system|user)_data_dirs may help if the program is installed.<br>
<br>
And using Glib::File::query_exists() before calling create_from_file<br>
will prevent throwing an exception (useful to search your file through<br>
directories ;))<br>
<br>
A linux-only application may read /proc/PID/exe, but it's not portable,<br>
and you may use gtk for this ;)<br>
<br>
--<br>
Bastien<br>
<br>
<br>
</div></div></blockquote></div><br></div>