wxImageList invalid use of incomplete type Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Everydaydiesel
Earned some good credits
Earned some good credits
Posts: 125
Joined: Wed Oct 28, 2015 9:48 pm

wxImageList invalid use of incomplete type

Post by Everydaydiesel »

Hello I am trying to add icons to a wxTreeCtrl and I am setting up the wxImageList and get the error

Code: Select all

error: invalid use of incomplete type 'class wxImageList'

Code: Select all

    wxImageList *imgList;
    wxBitmap bmps[2];
    bmps[0] = wxIcon(BASE_IMAGE_ICON_PATH + "Filetype-jpg-icon.png");
    bmps[1] = wxIcon(BASE_IMAGE_ICON_PATH + "FolderClose.png");

    imgList = new wxImageList(32, 32);          // this is where the error is

    for (int j = 0; j < WXSIZEOF(bmps); j++ )
    {
        imgList->Add(bmps[j]);
    }
I am not sure what is causing this since the constructor takes 2 values (+2 defaults)
https://docs.wxwidgets.org/3.0/classwx_image_list.html

Thanks in advance!
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxImageList invalid use of incomplete type

Post by doublemax »

The error message sounds like you didn't #include <wx/imaglist.h>
Use the source, Luke!
Everydaydiesel
Earned some good credits
Earned some good credits
Posts: 125
Joined: Wed Oct 28, 2015 9:48 pm

Re: wxImageList invalid use of incomplete type

Post by Everydaydiesel »

doh. i spent entirely too long on this! Thanks for the help
Post Reply