Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to port some boilerplate code of mine to work on android, using the android ndk & NativeActivity

So far I have just one file that defines the glue between android and my code and it works fine. It includes one GLIncludes file, that sorts out the includes based on platform

However, if I add glm headers to the GLIncludes file, becoming:

#ifdef __ANDROID_API__
    #include <EGL/egl.h>
    #include <GLES/gl.h>
    #include <GLES/glext.h>
#endif

#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/type_ptr.hpp"

ndk-build then complains about not finding glm.hpp:

In file included from jni/src/GLIncludes.h:41:0,
                 from jni/androidLauncher.cpp:4:
jni/src/glm/glm.hpp:86:18: fatal error: limits: No such file or directory

I have verified that the file does indeed lie at < ANDROID_PROJECT_ROOT >/jni/src/glm/glm.hpp so what could be the problem?

Here is my Android.mk file that sits in the jni folder:

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := libglobes
LOCAL_CFLAGS    := -Werror
LOCAL_LDLIBS    := -llog -lGLESv1_CM -lEGL -lm -landroid
LOCAL_CPP_EXTENSION := .cpp
LOCAL_STATIC_LIBRARIES := android_native_app_glue

LOCAL_SRC_FILES := androidLauncher.cpp

include $(BUILD_SHARED_LIBRARY)

$(call import-module,android/native_app_glue)

My directory structure is:

< ROOT >
    src/ (dir with all sources in it)
        GLIncludes.h
        glm/
            glm.hpp
    android/ (base dir for android port)
        jni/
            androidLauncher.cpp
            Android.mk
            src/ (symbolic link to upper src folder with same contents)

So why is the ndk-build not seeing the glm.hpp files? Is it because it is too deep? or is it because of the symbolic link? Or is it something else completely?

Thanks

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

You need to read the error message more carefully:

In file included from jni/src/GLIncludes.h:41:0,
                 from jni/androidLauncher.cpp:4:
jni/src/glm/glm.hpp:86:18: fatal error: limits: No such file or directory

As you can see, the glm.hpp header is found. It's limits that is not found, because by default the NDK uses a stripped-down C++ runtime library.

You will need to read CPLUSPLUS-SUPPORT.html to choose what kind of runtime is best for you. In the meantime, adding this to Application.mk will probably work:

APP_STL := gnustl_static
share|improve this answer
    
AH! Thanks a lot mate Will try that when I'm at my build machine –  codemonkey Jan 10 '13 at 10:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.