简体   繁体   中英

How to include Cocos2dx UI library in Android project

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

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.

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 technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM