vendredi 26 mai 2017

error: invalid operands of types ‘const char [8]’ and ‘const char [7]’ to binary ‘operator<<’

I am getting the following error:

error: invalid operands of types ‘const char [8]’ and ‘const char [7]’ to binary ‘operator<<’

with the following code. Any idea why?

main.cpp

#include <sstream>      // std::stringstream

#define logStream(MSG) _logStream(MSG)

void _logStream(std::string MSG)
{ 
    std::stringstream _trace_stream_;
    _trace_stream_ << "logStream: " << MSG << std::endl;
}  

int main()
{
    logStream("Hello, " << "world!");    // compile error here

    return 0;
}

Aucun commentaire:

Enregistrer un commentaire