This code works just fine on Windows, but when I compile for android it fails to build.
This is the problem function.
FString ACashierController::StringFromBinaryArray(const TArray<uint8>& BinaryArray)
{
std::string cstr(reinterpret_cast<const char*>(BinaryArray.GetData()), BinaryArray.Num());
return FString(cstr.c_str());
}
And this is the build error I’m getting.
UnrealBuildTool: C:/Users//game/Source/game/CashierController.cpp:40: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned int, std::allocator<char> const&)'
UnrealBuildTool: C:/android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include\ext/atomicity.h:83: error: undefined reference to '__gnu_cxx::__exchange_and_add(int volatile*, int)'
UnrealBuildTool: C:/android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include\bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator<char> const&)'
UnrealBuildTool: C:/android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include\bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage'
UnrealBuildTool: C:/Users//game/Source/game/LoginUI.cpp:129: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned int, std::allocator<char> const&)'
UnrealBuildTool: C:/android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include\ext/atomicity.h:83: error: undefined reference to '__gnu_cxx::__exchange_and_add(int volatile*, int)'
UnrealBuildTool: C:/android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include\bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator<char> const&)'
UnrealBuildTool: C:/android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include\bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage'
UnrealBuildTool: C:/Users//game/Source/game/MainMenu.cpp:107: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned int, std::allocator<char> const&)'
UnrealBuildTool: C:/android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include\ext/atomicity.h:83: error: undefined reference to '__gnu_cxx::__exchange_and_add(int volatile*, int)'
UnrealBuildTool: C:/android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include\bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator<char> const&)'
UnrealBuildTool: C:/android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include\bits/basic_string.h:249: error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage'
UnrealBuildTool: clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)