Invalid operands of type ‘int’ and ‘const char BRACKET3BRACKET’ to binary ‘operator(LTLT)’
From Cppsyntax
Commas instead of angle brackets
One way you can get error messages like this
invalid operands of types ‘int’ and ‘const char [3]’ to binary ‘operator<<’
if you have a comma where there should be a <<.
(If you are used to printfs, it's easy to let your fingers type a comma instead of a <<.)
WRONG
#include <iostream>
int main(void)
{
cout << "A", i << "BB"; // the comma messes things up
return 0;
}
RIGHT
#include <iostream>
int main(void)
{
cout << "A" << i << "BB"; // yay, this works!
return 0;
}
Count instead of cout
Another way you can get messages like
invalid operands of types ‘<unknown type>’ and ‘const char [9]’ to binary ‘operator<<’
is if you type "count" instead of cout.
WRONG
#include <iostream>
int main(void)
{
count << "A" << i << "BB";
return 0;
}
RIGHT
#include <iostream>
int main(void)
{
cout << "A" << i << "BB"; // yay, this works!
return 0;
}
