Using cocos ui library

Please answer these questions to help fix this issue:
What’s the issue?
I can’t compile for Android when using the Cocos UI library.

What’s the engine version?
V3.0

How to reproduce it?
drop "#include “CocosGUI.h” into any scene and try to compile for Android.
Then the following error occurs - “fatal error: CocosGUI.h: No such file or directory”
There have been other post in the forum about this problem, but no solution.

I solved the problem by getting the right libraries to compile in the make file.

Here is what I added:

LOCAL_C_INCLUDES := …
$(LOCAL_PATH)/…/…/cocos2d/cocos/ui \

AND ADDING THESE LINES IN THE RIGHT SECTIONS

LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
$(call import-module,editor-support/cocostudio)

The right solution is to change your includes of the CocosGUI class header by adding the “ui/” prefix like this:

#include “ui/CocosGUI.h”

I got it by this SO answer: http://stackoverflow.com/a/28270366/993746

1 Like

Check out the Programmers Guide sample code: https://github.com/chukong/programmers-guide-samples

I have also modified Chapter 6 in the Programmers Guide to state this include for the UI widgets. It will get updated in my next push today.