The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL 2.0.4-9174 on android
theGiallo


Joined: 03 Nov 2014
Posts: 11
Location: Genova, IT
Porting for the first time to Android I came across this problem. The linker won't find the symbol for SDL_Android_Init because it's on a C library but SDL_android_main is now a cpp, so in SDL_android_main.cpp

extern "C" is needed to surround the extern void SDL_Android_Init declaration.

Before:
[code=cpp]
/* Called before SDL_main() to initialize JNI bindings in SDL library */
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
[/code]

After:
[code=cpp]
#ifdef __cplusplus
extern "C"
{
#endif
/* Called before SDL_main() to initialize JNI bindings in SDL library */
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
#ifdef __cplusplus
}
#endif
[/code]


(I hope this is the correct way to communicate a bug)