I’m trying to build the Android version of SDL on Windows. I’ve followed
this video to help get the basics set up: (I get as far as 3mins in before
I get stuck)
When I run ndk-build I get the follow error :?? SDL_android_main.c:23:
error: undefined reference to ‘SDL_Android_Init’
I’m trying to build the Android version of SDL on Windows. I’ve followed
this video to help get the basics set up: (I get as far as 3mins in before
I get stuck)
When I run ndk-build I get the follow error : SDL_android_main.c:23:
error: undefined reference to ‘SDL_Android_Init’
For some reason it’s skipping over the libSDL2.so build part…are you
using SDL2’s own android-project?
I would suggest testing with the build-scripts/androidbuild.sh script, but
that will only work on Linux. In theory it should be possible to build from
Windows, I just never tried it.–
Gabriel.
Ah, it’s my mistake, I’d copied the SDL source to jni/src instead of jni/
Now that’s correct, the SDL lib builds just fine.
However, I now get this error:
snip
[armeabi] Compile thumb : SDL2 <= SDL_test_md5.c
[armeabi] Compile thumb : SDL2 <= SDL_test_random.c
[armeabi] SharedLibrary : libSDL2.so
[armeabi] Install : libSDL2.so => libs/armeabi/libSDL2.so
[armeabi] Compile thumb : main <= SDL_android_main.c
[armeabi] Compile++ thumb: main <= main.cpp
[armeabi] StaticLibrary : libstdc++.a
[armeabi] SharedLibrary : libmain.so
H:/android-sdk/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/…/lib/gcc/arm-linux-androideabi/4.6/…/…/…/…/arm-linux-androideabi/bin/ld.exe: H:\SVN_Repository\android-project/obj/local/armeabi/objs/main/__/SDL/src/main/android/SDL_android_main.o: in function Java_org_libsdl_app_SDLActivity_nativeInit:H:\SVN_Repository\android-project/jni/src/…/SDL/src/main/android/SDL_android_main.c:32: error: undefined reference to 'SDL_main’
collect2: ld returned 1 exit status
make.exe: *** [H:\SVN_Repository\android-project/obj/local/armeabi/libmain.so] E
rror 1
The linker is not finding your main() function (which SDL redefines to
SDL_main). Make sure that main.cpp has a main() function and that its
signature is exactly as SDL expects:
int main(int argc, char* argv[])
I just looked at the main.cpp from the video you linked. It does have a
non-conformant main() that has a ‘const’ specifier. My guess is that’s the
issue.
Jonny DOn Mon, Mar 31, 2014 at 11:28 AM, Jonathan Dearborn <@Jonathan_Dearborn>wrote:
The linker is not finding your main() function (which SDL redefines to
SDL_main). Make sure that main.cpp has a main() function and that its
signature is exactly as SDL expects:
int main(int argc, char* argv[])