I am working on a mostly C++ 2D game engine for the Android OS. As most of you know, the Android OS uses Java as its language of choice, so I am making heavy use of the JNI and the Android NDK. Now, I got all of the hooks working right, so I know the JNI is working correctly, and each of the individual C/C++ libraries I am making use of compiles without error. My problem comes when I try to reference Lua (luabind seems to work fine, but I won't know for sure until I get passed the Lua side of things) from my own code. I get the following compilation errors when I do so:
[media]http://img851.imageshack.us/img851/3586/consoleerror.jpg[/media]
I have done a lot of searching on the error the last few days, but I haven't been able to come up with anything at all. It seems to be a linking issue rather than a compilation issue, as it doesn't come up until everything is finished compiling. Here is the make file I am using for the troublesome code:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := main
SDL_PATH := ../sdl
LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include \
$(LOCAL_PATH)/../luabind \
$(LOCAL_PATH)/../lua/src
# Add your application source files here...
#LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
# main.cpp \
LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
main.cpp \
Animation.cpp \
Node.cpp \
Renderer.cpp \
GameObject.cpp \
Video.cpp \
Texture2D.cpp \
Globals.cpp \
Script.cpp
LOCAL_SHARED_LIBRARIES := SDL
LOCAL_STATIC_LIBRARIES := Lua LuaBind SDL_image
LOCAL_LDLIBS := -lGLESv1_CM -llog
LOCAL_CPPFLAGS := -fexceptions
include $(BUILD_SHARED_LIBRARY)
I should note that I am not very experienced with make files, so there is a great possibility that it is something wrong in that "code,"
I am really not sure what exactly to add code-wise, but I suppose I will post the code that I have narrowed the problem down to.
#include "Globals.h"
#include "SDL.h"
#include "Script.h"
#include "GameObject.h"
extern "C"
int main(int argc, char *argv[])
{
init_lua();
free_lua();
return 0;
}
init_lua() and free_lua() are declared in Globals.h and defined in Globals.cpp, and are simply a wrapper for lua_open() and lua_close() using a global lua_State pointer that is also declared in Globals.h.
I should also mention that if I remove the two methods from the main function, it compiles fine.