gluUnProject()
is not a part of OpenGL ES. It is a part of GL Utility library GLU
which is not exposed by the Android NDK.
There is a port of GLU library for Android - GLU ES: http://code.google.com/p/glues/ Just use it.
Question
I am trying to use gluUnProject()
in my function to translate 2D coordinates of viewport to 3D world model. But, when I try to build, I get this message:
D:/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe:
./obj/local/armeabi/objs-debug/tuxrider/src/course_load.o: in function get_OGL_position:jni/tuxrider/src/course_load.c:124: error: undefined reference to 'gluUnProject' collect2: ld returned 1 exit status
/cygdrive/d/android-ndk-r8d/build/core/build-binary.mk:397: recipe for target `obj/local/armeabi/libtuxrider.so' failed make: *
[obj/local/armeabi/libtuxrider.so] Error 1
Indexer in Eclipse, recognizes this function, but ndk-build
doesn't. Is there a problem with OpenGLES 2.0?
Solution
gluUnProject()
is not a part of OpenGL ES. It is a part of GL Utility library GLU
which is not exposed by the Android NDK.
There is a port of GLU library for Android - GLU ES: http://code.google.com/p/glues/ Just use it.
OTHER TIPS
collect2: ld returned 1 exit status
This is a cryptic but common error from the linker (named ld), you have likely included the header for openGL-ES, but neglected to actually link against the library.