I have been searching around for a solution to this for a while. I’m trying to use the “>>” and “<<” operators as shown below but keep getting the error “No operator ‘>>’ matches these operands”. Here are the code snippets:
#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <fstream>
#include <string>
...
int blah;
std::string level;
level >> blah;
thisDot.setX(blah);
level >> blah;
thisDot.setY(blah);
Several of the posts I have found on this topic have had the solution of simply including #include <string>, but as you can see I have included that and am still getting the error. I have also tried #include string.h but that doesn’t help either. Any ideas as to why this would still be happening?…it may be worth noting that I’m using the SDL library.
You misread the example. The example is reading from a file, not a string.
Notice that it is
loadthat appears on the left of the>>, notlevel.