Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Undefined reference errors when compiling the android example  (Read 2232 times)

0 Members and 1 Guest are viewing this topic.

Sixmorphugus

  • Newbie
  • *
  • Posts: 3
    • View Profile
Undefined reference errors when compiling the android example
« on: November 08, 2015, 11:32:36 pm »
So I compiled the SFML android libs, in visual studio 2015. I'm not sure if this is the way you're supposed to do it, but this way has lead me furthest so far. If it's obviously the wrong way, please tell me how I could have done it differently. Anyway, I then cmake installed it.

When trying to make (via the make file) the example project, I get this output:
Quote
1>------ Build started: Project: Cumulus, Configuration: Debug Tegra-Android ------
1>  [armeabi-v7a] Compile++ thumb: sfml-example <= main.cpp
1>  [armeabi-v7a] Gdbserver      : [arm-linux-androideabi-4.8] Tegra-Android/Debug//libs/armeabi-v7a/gdbserver
1>  [armeabi-v7a] Gdbsetup       : Tegra-Android/Debug//libs/armeabi-v7a/gdb.setup
1>  [armeabi-v7a] Install        : libsfml-activity.so => Tegra-Android/Debug//libs/armeabi-v7a/libsfml-activity.so
1>  [armeabi-v7a] Install        : libsfml-system.so => Tegra-Android/Debug//libs/armeabi-v7a/libsfml-system.so
1>  [armeabi-v7a] Install        : libsfml-window.so => Tegra-Android/Debug//libs/armeabi-v7a/libsfml-window.so
1>  [armeabi-v7a] Install        : libsfml-graphics.so => Tegra-Android/Debug//libs/armeabi-v7a/libsfml-graphics.so
1>  [armeabi-v7a] Install        : libsfml-audio.so => Tegra-Android/Debug//libs/armeabi-v7a/libsfml-audio.so
1>  [armeabi-v7a] Install        : libsfml-network.so => Tegra-Android/Debug//libs/armeabi-v7a/libsfml-network.so
1>  [armeabi-v7a] Install        : libc++_shared.so => Tegra-Android/Debug//libs/armeabi-v7a/libc++_shared.so
1>  [armeabi-v7a] Install        : libopenal.so => Tegra-Android/Debug//libs/armeabi-v7a/libopenal.so
1>  [armeabi-v7a] SharedLibrary  : libsfml-example.so
1>D:\Repos\Cumulus\jni\main.cpp(10): error :  error: undefined reference to 'sf::String::String(char const*, std::__1::locale const&)'
1>D:\Repos\Cumulus\jni\main.cpp(13): error :  error: undefined reference to 'sf::Texture::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sf::Rect<int> const&)'
1>D:\Repos\Cumulus\jni\main.cpp(21): error :  error: undefined reference to 'sf::Music::openFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
1>  D:/AndroidNDK/sources/sfml/lib/armeabi-v7a/libsfml-main.a(MainAndroid.o):MainAndroid.cpp:function ANativeActivity_onCreate: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::rdbuf(std::basic_streambuf<char, std::char_traits<char> >*)'
1>  D:/AndroidNDK/sources/sfml/lib/armeabi-v7a/libsfml-main.a(MainAndroid.o):MainAndroid.cpp:function onDestroy(ANativeActivity*): error: undefined reference to 'std::locale::~locale()'
1>  D:/AndroidNDK/sources/sfml/lib/armeabi-v7a/libsfml-main.a(MainAndroid.o):MainAndroid.cpp:function onDestroy(ANativeActivity*): error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator<char> const&)'
1>  D:/AndroidNDK/sources/sfml/lib/armeabi-v7a/libsfml-main.a(MainAndroid.o):MainAndroid.cpp:function onDestroy(ANativeActivity*): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage'
1>  D:/AndroidNDK/sources/sfml/lib/armeabi-v7a/libsfml-main.a(MainAndroid.o):MainAndroid.cpp:function onDestroy(ANativeActivity*): error: undefined reference to 'vtable for std::basic_streambuf<char, std::char_traits<char> >'
1>  D:/AndroidNDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
1>  collect2.exe: error: ld returned 1 exit status
1>  make.exe: *** [Tegra-Android/Debug//local/armeabi-v7a/libsfml-example.so] Error 1
I have no idea what most of this means but I assume it's a problem involving the standard libaries.

I've tried recompiling sfml's android bindings with the STL Types "GNU libstdc++ Shared" and "GNU libstdc++ Static". No difference.

I've tried moving things around in Application.mk. This makes errors bigger, not smaller.

I've tried redownloading sfml and starting the whole process again. No difference.

I'm kind of tired of guessing and can't find any tutorials that don't either gloss over the part of the process I'm struggling with or leave out major details entirely. I'm very keen to develop for android with SFML. If anyone could help, it would really be appreciated.
« Last Edit: November 08, 2015, 11:45:28 pm by Sixmorphugus »

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Undefined reference errors when compiling the android example
« Reply #1 on: November 09, 2015, 09:43:59 am »
How did you compile with MSVC? Last time I tried, it didn't get things right when compiling SFML itself, so my best bet would be using "MinGW Makefiles" and compile it with make as well.

Sixmorphugus

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Undefined reference errors when compiling the android example
« Reply #2 on: November 09, 2015, 11:31:48 pm »
How did you compile with MSVC? Last time I tried, it didn't get things right when compiling SFML itself, so my best bet would be using "MinGW Makefiles" and compile it with make as well.
Alright, I'll try that.

EDIT: Success! Worked with MinGW_make.
« Last Edit: November 09, 2015, 11:54:20 pm by Sixmorphugus »