erreur C2679: binaire " <<": l'opérateur n'a pas trouvé ce qui prend de la main droite opérande de type “std::string”

Code:

    #include "stdafx.h"
    #include <iostream>
    #include <fstream>
    #include <string.h>

    using namespace std;
    int main()
        {
            ifstream fin ("ride.in.txt");
            ofstream fout ("ride.out.txt");
            int ta, tb;unsigned int i;
            ta = tb = 1;
            string a, b;
            fin >> a >> b;
            for (i = 0; i < a.size(); i++)
                ta = ta * (a[i] - 'A' + 1) % 47;
            for (i = 0; i < b.size(); i++)
                tb = tb * (b[i] - 'A' + 1) % 47;
            if (ta == tb)
                fout << "GO" << endl;
            else    
                fout << "STAY" << endl;
            return 0;
        }

Erreur:

error C2679: 
binary '<<' : no operator found which takes a right-hand operand of type  std::string
  • Il n'est pas question, et le code se compile (lors du retrait du pas-à condition d'en-tête précompilé) sur clang.
  • Compiler sur un compilateur qui est la bibliothèque qui arrive à inclure <string> dans <fstream> ou <iostream>. Un standard C++ en-tête est autorisée à inclure tout autre en-tête standard.
  • Je ne comprends pas pourquoi cela a été fermé. C'est une vraie question et il y a des réponses. De toute façon, il y a des réponses à une question similaire, ici.
InformationsquelleAutor liang zhang | 2011-12-30