Why Gdk::Pixbuf not load from resources, when execute outside MSYS2?

71 views Asked by At

In code, I create an image and write it from resources. When I run the program outside the msys2 console, no image is created and no thrown. From msys2 console it`s ok!

auto img = Gtk::make_managed<Gtk::Image>();
Glib::RefPtr<Gdk::Pixbuf> pbuf = nullptr;
try
{
    pbuf = Gdk::Pixbuf::create_from_resource(<path_in_res>, 100, 100);
    img->set(pbuf);
}
catch (const Glib::FileError &e)
{
    std::cerr << e.what() << '\n';
}
catch (const Gdk::PixbufError &e)
{
    std::cerr << e.what() << '\n';
}

I change for test `pbuf = Gdk::Pixbuf::create_from_resource(<path_in_res>, 100, 100);

pbuf = Gdk::Pixbuf::create_from_file(<path_to_file>, 100, 100);` Load pixbuf only execute my programm in the msys2 console. Thank!

0

There are 0 answers