cocos2d-x 3.0alpha1 gui missing headers


I got problem when importing UILayer to my project using
#include “UILayer.h”

I got missing headers of “gui/xxx.h”

I solved it by removing “gui/” from the include path.

But this solution creating another problem when compiling for android. I ran, I got error can’t find “UILayer.h”. So I have to change the path to “gui/UILayer.h” again, which then breaks when compiling in win32.

Is there any better solution for this?

Feedbacks of v3.0-beta

solved it. It seems I have to change the default project include directory from $(EngineRoot)cocos\gui to $(EngineRoot)cocos


I’m having the same problem too. I can’t use the GUI library at all. I’ve tried your solution and it only introduced more header file related error. Maybe I’ll just wait for a real fix on this.


what’s the error you’re having?


Well, I’ve tried it again on a completely new project, change the $(EngineRoot)cocos\gui to $(EngineRoot)cocos, include the gui/CocosGUI.h and visual studio spat this error:

HelloWorldScene.obj : error LNK2019: unresolved external symbol "public: __thiscall cocos2d::gui::Margin::Margin(void)" (??0Margin@gui@cocos2d@@QAE@XZ) referenced in function "void __cdecl cocos2d::gui::`dynamic initializer for 'MarginZero''(void)" (??__EMarginZero@gui@cocos2d@@YAXXZ)


I got another problem with integrating cocostudio Well it seems the new beta3 version doesn’t have UILayer. What should I use to integrate cocostudio ui?

@Jonah T : maybe you haven’t linked your project to LibGUI project in your solution.


Hey Herman,

Yeah I haven’t linked it. Weird coz I needn’t to do this before with cocos2d-x. It’s all working now. Thanks!

About UILayer, it has been removed in v3beta. They restructured the library and I think Widget class is now a subclass of Node. So you won’t need the UILayer to add ui elements to your Layers/Scenes or even to your Sprites… basically everything that has an addChild() function that takes Node as parameter. Which I think make sense; as to where cocos2d-x is heading we will probably don’t need the Layer class entirely.


Could you provide an example pls? I am facing the same problem. I added libGUI to vs and I am linkin to it (i think). I used the UI Editor to export a json file and now I am trying to load it.