Jump to content
  • Advertisement
Sign in to follow this  
JonBonazza

Weird compilation errors...

This topic is 2444 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, so I wasn't quite sure where to put this, so let me first give some background info to further detail the problem.

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.

Share this post


Link to post
Share on other sites
Advertisement
That's what I was thinking, but it's odd. I specify in my Application.mk (which the Android NDK says to name it) that I want the compilation to us GNU STL. stdc++ is includeded in the STL library, right? Or am I mistaken?

Share this post


Link to post
Share on other sites
It seems I was wrong. According to wiki

The C++ Standard Library is based upon conventions introduced by the [color="#0645ad"]Standard Template Library (STL). Although the C++ Standard Library and the STL share many features, neither is a strict superset of the other.
[/quote]


I will try explicitly specifying to link with the stdc++ library.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!