如何使用GLM在Android的NDK应用 [英] How to use GLM in Android NDK Application

查看:2421
本文介绍了如何使用GLM在Android的NDK应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在移植我的OpenGL应用程序到Android和我停留在如何导入和建立GLM HTTP: //glm.g-truc.net/ 正常。我在标准C ++应用程序使用GLM没有问题,但是我pretty新来的NDK。我曾尝试在网上贴出周围没有运气的所有其他解决方案。以下是我迄今为止:

I am currently trying to port my OpenGL application to Android and am stuck on how to import and build GLM http://glm.g-truc.net/ properly. I have no trouble using GLM in standard C++ apps, however I am pretty new to the NDK. I have tried all other solutions posted around the web with no luck. Here is what I have so far:

我使用的是最新版本的GLM(0.9.4)

I am using the latest version of GLM (0.9.4)

我的.cpp文件包括:

My .cpp file contains:

    #include <glm\glm.hpp>

我的Andr​​oid.mk文件看起来像:

My Android.mk file looks like:

    LOCAL_PATH:= $(call my-dir)

    include $(CLEAR_VARS)

    LOCAL_MODULE    := libgl2jni
    LOCAL_CFLAGS    := -Werror
    LOCAL_SRC_FILES := gl_code.cpp
    LOCAL_LDLIBS    := -llog -lGLESv2

    APP_STL := gnustl_static
    LOCAL_C_INCLUDES += \Development\OpenGL\glm-0.9.4.0\

    include $(BUILD_SHARED_LIBRARY)

*的 \\开发\\的OpenGL \\ GLM-0.4.0 * 的是GLM文件我的C盘上的位置

*\Development\OpenGL\glm-0.4.0* is the location of the GLM files on my C drive

建筑后,我收到此错误:

Upon building, I receive this error:

   In file included from jni/gl_code.cpp:28:0,
       \Development\OpenGL\glm-0.94.0\glm\glm.hpp:86:18: fatal error: limits: No such file or directory

这类似于codemonkey的问题<一href=\"http://gamedev.stackexchange.com/questions/47128/android-ndk-build-cant-find-glm-headers\">http://gamedev.stackexchange.com/questions/47128/android-ndk-build-cant-find-glm-headers其中,APP_STL:= gnustl_static'。建议

This resembles codemonkey's problem http://gamedev.stackexchange.com/questions/47128/android-ndk-build-cant-find-glm-headers where the 'APP_STL := gnustl_static' was suggested.

看来,我的源文件是正确的设置,但是有某种编译器的问题,我无法确定的。任何帮助是极大AP preciated!

It appears that my source files are correctly setup, however there is some sort of compiler problem that I cannot identify. Any help is greatly appreciated!

推荐答案

山姆Hocevar的回答codemonkeys问题是正确的。它不是GLM这就是问题所在。它是由GLM用限制头文件,这就是问题所在。

Sam Hocevar's answer to codemonkeys problem is correct. it's not glm that's the problem. It's the "limits" header file used by glm that's the problem.

如果萨姆的回答没有解决您的问题,试图通过添加以下到您的Application.mk文件中更改工具链​​到以前的版本:

If Sam's answer does not solve your problem, try changing the toolchain to an earlier version by adding the following to your Application.mk file:

NDK_TOOLCHAIN_VERSION=4.4.3

和确保在STL包括为您的项目在Eclipse的工具链相对应。
转到项目 - >属性 - > C / C ++常规 - >路径和符号

And make sure that the STL includes for your project in Eclipse correspond with the toolchain. Go to project->properties->C/C++ General->Paths and Symbols

请确保以下目录包括:

修改:这些仅仅是例子;确保您使用了正确的平台和ABI

EDIT : these are only examples; make sure you use the correct platform and abi

/Path/To/NDK/sources/platforms/android-9/arch-arm/usr/include
/Path/To/NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include
/Path/To/NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include

编辑:备注上取下第一个目录;似乎GLM查找当前STL实现所提供的限制文件

EDIT : remark on first directory removed; seems glm looks for the limits file provided by the current stl implementation

这篇关于如何使用GLM在Android的NDK应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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