mardi 26 décembre 2017

Android NDK16 error ("operator '< >' and 'long long')"

In an attempt to transition from NDK 15c to NDK16b I've hit a roadblock compiling legacy code that is trying to write 64 bit values to ostream.

I've searched the NDK header files and it seems to me that in std/_ostream. that if #ifdef _STLP_LONG_LONG is defined then the ostream operator should support what I'm trying to do.

I fail to see what I need to do to enable this. I've tried defining that with -D_STLP_LONG_LONG to no avail.

Here is the actual compiler output:

MyInfo.cc:6499:33: error: use of overloaded operator '<<' is ambiguous (with operand types 'basic_ostream<char, std::char_traits<char> >' and 'long long')
      os << basename << ":" << (long long) val;
      ~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:104:10: note: candidate function
_Self& operator<<(unsigned char __x) { _M_put_char(__x); return *this; }
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:106:10: note: candidate function
_Self& operator<<(short __x);
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:107:10: note: candidate function
_Self& operator<<(unsigned short __x);
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:108:10: note: candidate function
_Self& operator<<(int __x);
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:110:10: note: candidate function
_Self& operator<<(unsigned int __x);
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:117:10: note: candidate function
_Self& operator<<(long __x);
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:118:10: note: candidate function
_Self& operator<<(unsigned long __x);
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:123:10: note: candidate function
_Self& operator<<(float __x);
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:124:10: note: candidate function
_Self& operator<<(double __x);
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:126:10: note: candidate function
_Self& operator<<(long double __x);
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:130:10: note: candidate function
_Self& operator<<(bool __x);
     ^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:304:1: note: candidate function [with _Traits = std::char_traits<char>]
operator<<(basic_ostream<char, _Traits>& __os, char __c) {
^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:297:1: note: candidate function [with _CharT = char, _Traits = std::char_traits<char>]
operator<<(basic_ostream<_CharT, _Traits>& __os, char __c) {
^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:311:1: note: candidate function [with _Traits = std::char_traits<char>]
operator<<(basic_ostream<char, _Traits>& __os, signed char __c) {
^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_ostream.h:318:1: note: candidate function [with _Traits = std::char_traits<char>]
operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) {
^
/Users/spartygw/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/stl/_iomanip.h:96:1: note: candidate function [with _CharT = char, _Traits = std::char_traits<char>]
operator<<(basic_ostream<_CharT, _Traits>& __os,
^

Aucun commentaire:

Enregistrer un commentaire