添加cpp文件到cocos2d-x项目android项目 [英] Adding cpp files to cocos2d-x project android project

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

问题描述

我遵循本教程 http://www.raywenderlich.com/33750/cocos2d-x-tutorial-for-ios-and-android-getting-started ,并设法在cococs2d-x中创建一个android hello world项目。现在,当我添加任何东西到我的类目录,并尝试使用它们,我会收到错误像

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()' 

我应该如何解决这些问题,并为我的eclipse项目添加已经工作的代码(在Xcode中)?

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

推荐答案

p>如果您向classes目录添加一个类,但忘记将其添加到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项目android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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