var_null
var_null

Reputation: 3

..msw\bitmap.cpp(842): assert ""image.IsOk()"" failed in wxBitMap::CreateFromImage(): invalid image [C++][wxWidgets 3.1.3]

The following code compiles and runs fine under Linux:

https://i.postimg.cc/B6PPn01C/Screenshot-20200320-184650.png

staticboxsizer_Logo = new wxStaticBoxSizer(wxHORIZONTAL, Panel1, wxEmptyString);
    staticbitmap_logo = new wxStaticBitmap(Panel1, ID_STATICBITMAP2, wxBitmap(wxImage(_T("C:\Logo_0.png"))), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICBITMAP2"));
    staticboxsizer_Logo->Add(staticbitmap_logo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);[/code]

Under Windows it compiles fine too, however when I run the .exe I get the following error:

C:\wxWidgets\src\msw\bitmap.cpp(842): assert ""image.IsOk()"" failed in wxBitMap::CreateFromImage(): invalid image

What can I do so the logo (265x46 px) also shows fine under Windows?

Thanks

Upvotes: 0

Views: 1856

Answers (1)

catalin
catalin

Reputation: 1987

You need to use a valid file path.

"/mnt/data/VMware/VM-Shared/Logo_0.png" is not a valid path under Windows.

Upvotes: 1

Related Questions