简体   繁体   English

eclipse - 为GooglePlayServices设置C ++包含

[英]eclipse - Setting up C++ includes for GooglePlayServices

I am working on a cocos2d-x project and am integrating Google Play Services. 我正在开发一个cocos2d-x项目,正在整合Google Play服务。

I am following the tutorial here: https://developers.google.com/games/services/cpp/GettingStartedNativeClient 我在此处遵循教程: https//developers.google.com/games/services/cpp/GettingStartedNativeClient

I am also referencing this guide: 我也参考了这个指南:

https://developers.google.com/games/services/cpp/gettingStartedAndroid https://developers.google.com/games/services/cpp/gettingStartedAndroid

I have set up my SDK and NDK and the Google play SDK location in the environment variables. 我已在环境变量中设置了我的SDK和NDK以及Google Play SDK位置。 The Google Play environemtn variable is NDK_MODULE_PATH="/Users/MyName/Documents/" Google Play environemtn变量为NDK_MODULE_PATH =“/ Users / MyName / Documents /”

The gpg-cpp-sdk folder is in Documents too as the guide said I needed. gpg-cpp-sdk文件夹也在文档中,因为指南说我需要。

The guide mentions an example project 'minimalist' which I cannot find anywhere. 该指南提到了一个我无法在任何地方找到的示例项目“极简主义”。 I have moved passed that and done the step where it says to add in JNI_OnLoad: 我已经移动了并完成了它在JNI_OnLoad中添加的步骤:

gpg::AndroidPlatformConfiguration platform_configuration;
platform_configuration.SetActivity(state->activity->clazz);

When I compile, it complains that gpg is undefined. 当我编译时,它抱怨gpg是未定义的。 I went into my cocos2d-x project and added the header directory and the library directory and still no luck. 我进入了我的cocos2d-x项目并添加了头目录和库目录,但仍然没有运气。

I've tried: 我试过了:

#include <gpg/gpg.h>
#include <gpg.h>
#include "gpg/gpg.h"
#include "gpg.h"

No luck. 没运气。

Can anyone point me in the right direction of getting this set up? 有人能指出我正确的方向来设置这个吗? What should be included? 什么应该包括在内? Is my environment variable for the google play services set up correcty? 我的环境变量是否适合Google Play服务设置正确?

Thank you. 谢谢。

UPDATE: It seems that due to the fact I have a makefile, it's not even considering the include directories. 更新:似乎由于我有一个makefile,它甚至没有考虑包含目录。 The problem is that I have no idea how to tell the makefile or Eclipse to also include these directories. 问题是我不知道如何告诉makefile或Eclipse也包含这些目录。

I am using Ant and Makefiles. 我正在使用Ant和Makefile。 If you have an Android.mk in the directory with the sources that use gpg, then add this to Android.mk 如果您在包含使用gpg的源的目录中有Android.mk,请将其添加到Android.mk

LOCAL_C_INCLUDES := \
        $(HOME)/src/gpg-cpp-sdk/android/include

Adapt the path to your situation. 根据您的情况调整路径。 I keep the gpg sdk in ~/src/ 我将gpg sdk保存在〜/ src /

And at the bottom of the Android.mk file: 在Android.mk文件的底部:

$(call import-module,gpg-cpp-sdk/android)

Lastly, examples on how to use gpg-cpp-sdk, including Minimalist, live on hithub: https://github.com/playgameservices/cpp-android-basic-samples 最后,关于如何使用gpg-cpp-sdk的例子,包括Minimalist,生活在hithub上: https//github.com/playgameservices/cpp-android-basic-samples

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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