Use of undeclared identifier 'Button', why?

Dear, i am trying the new gui system and I have this problem :smile:

void HelloWorld::loadInterface()
{
	Button bButton = Button::create();
}

Console give me :
error:unknown type name ‘Button’
error: use of undeclared identifier ‘Button’

Did you include the header file? #include "ui/CocosGUI.h"

Did you build and link libGUI?

1 Like

Thanks you iQD, it worked !

I’m still randomly getting this error with Cocos2d-x 3.9. I’m kind of confused in what namespace Button exists. Just including cocos2d.h doesn’t seem to work, and the above suggestion does not help.

the full of Button name is cocos2d::ui::Button
Don’t forget to include “ui/cocosgui.h”