samedi 30 janvier 2016

invalid operands to binary expression ('std::ostream' (aka 'basic_ostream

When trying to compile my c++ code with Cheerp (using clang++), I get this output from my terminal:

example.cpp:102:9: error: invalid operands to binary expression ('std::ostream'
      (aka 'basic_ostream<char>') and 'const char *')
    out << "(" << loc.x << ", " << loc.y << ")";
    ~~~ ^  ~~~

Here is my command to the terminal:

/opt/cheerp/bin/clang++ -target cheerp example.cpp -o example.js

And Here is the code it has trouble with:

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;
}

Aucun commentaire:

Enregistrer un commentaire