mardi 28 juin 2016

Why my compiler is showing some error's that shouldn't exist?


I've got 2 errors that makes me sick and a little bit confused. Error #1: error C2679: binary '+=' : no operator found which takes a right-hand operand of type 'std::basic_string<_Elem,_Traits,_Ax>' (or there is no acceptable conversion) Code to this error is: CString lancuch1; lancuch1 = "Znaleziono "; lancuch1 += liczba1.str(); lancuch1 += " pozycji."; And the second one, more weird: Error #2: error C2440: 'initializing' : cannot convert from 'std::_Vector_iterator<_Ty,_Alloc>' to 'std::basic_string<_Elem,_Traits,_Ax>' And this error i've got 7 times written to this code: for(int i = 0 ; i < pojemnosc_vectora; i++){ std::string linijka = (vector.begin()+i); char deli = ';'; int a = 0; for(int i = 0; i<5; i++){ std::string pokico = linijka.substr(a, deli); vector2.push_back(pokico); a+=pokico.length(); } } int licznik_komunikatow=0; for(int i=0; i<vector.size(); i++){ std::string komunikat1 = vector2.begin()+(licznik_komunikatow); std::string komunikat2 = vector2.begin()+(licznik_komunikatow+1); std::string komunikat3 = vector2.begin()+(licznik_komunikatow+2); std::string komunikat4 = vector2.begin()+(licznik_komunikatow+3); std::string komunikat5 = vector2.begin()+(licznik_komunikatow+4); CString komun,komun1,komun2,komun3,komun4; komun = komunikat1.c_str(); komun1 = komunikat2.c_str(); komun2 = komunikat3.c_str(); komun3 = komunikat4.c_str(); komun4 = komunikat5.c_str(); printf("Nazwa: %s n Cena: %s n Ilość: %s n Gdzie: %s n Kod: %s n ", komun, komun1, komun2, komun3, komun4 ); } Tell me is it my bad or Visual's 2005 bad. I'm a little bit tired of weird error's that I don't really understand. Anyone have an Idea how to fix this?

Aucun commentaire:

Enregistrer un commentaire