(clang ++を使用して)Cheerpでc ++コードをコンパイルしようとすると、端末から次の出力が得られます。
example.cpp:102:9: error: invalid operands to binary expression ('std::ostream'
(aka 'basic_ostream<char>') and 'const char *')
out << "(" << loc.x << ", " << loc.y << ")";
~~~ ^ ~~~
これが端末への私のコマンドです:
/opt/cheerp/bin/clang++ -target cheerp example.cpp -o example.js
そして、これが問題のあるコードです:
static std::ostream& operator <<(std::ostream & out, const CornerLoc &loc)
{
out << "(" << loc.x << ", " << loc.y << ")";
if (loc.type == kCorner)
out<<"-corner";
if (loc.type == kCornerNorthWest)
out<<"-cornerNW";
if (loc.type == kCornerNorthEast)
out<<"-cornerNE";
if (loc.type == kCornerSouthWest)
out<<"-cornerSW";
if (loc.type == kCornerSouthEast)
out<<"-cornerSE";
return out;
}
修正済み:: #include <iostream>