0
votes

I'm trying to include one of the UI classes in my cocos2dx project.

In my scene class I have:

 #include "CocosGUI.h"

It compiles fine for iOS, but when I try to use the command line to compile for Android I get the following error:

fatal error: CocosGUI.h: No such file or directory

I understand it's because it can't find the library. I've been trying to find the right one to add but haven't had any luck.

I've added:

LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_ui_static

and

$(call import-module,extensions)
$(call import-module,ui)

But that doesn't seem to help.

I'm using cocos2dx v3.0

2

2 Answers

7
votes

Change your import to "ui/CocosGUI.h". I am using 3.3.

You don't need to edit your Android.mk's import-module or import-add-path lines, or your build-cfg.json, all you need to do is change the specific headers to this generic one.

4
votes

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)