Re: could not display images using gtk_image_new_from_file



> In my application i've
> image=gtk_image_new_from_file("a.png");
>
> If i run the application on windows i see only a broken image though the
> file is present in the directory where the executable is present.

Well, it has to be in the current directory of the application, just
being in the directory where the executable is located isn't good
enough.

> I also tried giving absolute path such as C:\ but still it doesn't display image.

You did remember to use double backslashes like "C:\\a.png" ?

If it still didn't work, your GTK+ installation is probably mixed up,
and gdk-pixbuf can't find its loaders or something like that. How did
you install the GTK+ runtime, from what files or installers, from
where? Have you moved the DLLs around from where they were after
unzipping or installing? You shouldn't. You should keep the directory
structure intact. (You can remove unneeded stuff like the message
catalogs from share\locale (or lib\locale) or the pangoft2 DLL if you
don't need them.) You can move the whole GTK+ installation tree as a
whole, but don't move files around inside it.

--tml


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