添加CPP文件的Cocos2D-X项目的Andr​​oid项目 [英] Adding cpp files to cocos2d-x project android project

查看:174
本文介绍了添加CPP文件的Cocos2D-X项目的Andr​​oid项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经按照本教程中的http://www.raywenderlich.com/33750/cocos2d-x-tutorial-for-ios-and-android-getting-started,并设法创造cococs2d-X的机器人Hello World项目。现在,当我添加任何东西到我的classes目录,并尝试使用他们,我得到如下的错误

I've followed this tutorial http://www.raywenderlich.com/33750/cocos2d-x-tutorial-for-ios-and-android-getting-started, and managed to create an android hello world project in cococs2d-x. Now when I add anything to my classes directory and try to use them, I get errors like

make: *** [obj/local/armeabi/libgame.so] Error 1
undefined reference to 'ConstAndStats::getDevice()' 

我应该如何解决这些问题,并添加已经着手codeS(在X code)对于我的Eclipse项目?

How should I fix these problems, and add the already working codes (in Xcode) for my eclipse project?

推荐答案

如果你添加一个类中的类目录,但忘了将它从JNI文件夹添加到Android.mk文件,这种错误可能会出现。加入这样的:

This kind of error may appear if you add a class to the classes directory but forget to add it to the Android.mk file from the jni folder. Add something like this:

LOCAL_SRC_FILES := hellocpp/main.cpp \
          ../../Classes/YourClass.cpp \
          ../../Classes/YourLastClass.cpp

这篇关于添加CPP文件的Cocos2D-X项目的Andr​​oid项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆