How to fix invalid use of incomplete type when create a child class from Gtk::Menu?

74 Views Asked by At

when trying to create a custom menu class that is inherited from Gtk::Menu the following output containing invalid use of incomplete type is thrown

main.cc:5:28: error: invalid use of incomplete type ‘class Gtk::Menu’
    5 | class AppMenu: public Gtk::Menu
      |                            ^~~~
In file included from /usr/include/gtkmm-4.0/gtkmm.h:207,
                 from main.cc:1:
/usr/include/gtkmm-4.0/gtkmm/label.h:46:17: note: forward declaration of ‘class Gtk::Menu’
   46 | class GTKMM_API Menu;
      |   

main.cc

#include <gtkmm.h>
//#include <gtkmm/menu.h>

class AppMenu: public Gtk::Menu
{
    public:
        AppMenu();
};

int main()
{
    printf("Hello world\n");
    return 0;
}

I am compiling using the command

g++ main.cc 'pkg-config --cflags --libs gtkmm-4.0' -I/usr/include/gtkmm-4.0/gtkmm/menu.h

I tried using the header <gtkmm/menu.h> but this is not found for whatever reason, also i tried to use class Gtk::Menu; but this is wrong since the class is already declared in gtkmm header file

0

There are 0 best solutions below