Use of undeclared identifier 'Button', why?

Use of undeclared identifier 'Button', why?
0

#1

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’


#2

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

Did you build and link libGUI?


#3

Thanks you iQD, it worked !


#4

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.


#5

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