Reputation: 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
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