NDK 15cからNDK16bに移行しようとすると、私はNDKヘッダファイルを検索したAndroid NDK16エラー( "operator '<<'が曖昧です(オペランドタイプ 'basic_ostream <char、std :: char_traits <char>'および 'long long')"
。のostreamに64ビット長の長い値を書き込むしようとしているレガシーコードをコンパイルするバリケードを打っまし、#ifdef _STLP_LONG_LONG
が定義されていれば、その後のostream演算子はサポートしなければならないことstd/_ostream
に私には思えます私がやろうとしていること
私はこれを可能にするために何をする必要があるのか分からない。-D_STLP_LONG_LONGを無駄に定義しようとした。
私のツールチェーンは、NDKのclangコンパイラを使用しています。ここで
は、実際のコンパイラの出力です:
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,
^
'_STLP_LONG_LONG'はSTLPortのもののように聞こえます。本当にSTLPortを使用していますか?もしそうなら、代わりにlibC++やgnustlを使うことができない理由はありますか? – Michael
@Michaelあなたは正しいです!ツールチェーンはSTLとしてstlportで構築されました。私はlibC++(これはApplication.mkで定義したものです)を使用していると思っていましたが、私はツールチェーンの作成でその部分を見逃しました。あなたのコメントを回答として投稿してください。私はそれを受け入れます。 – spartygw