g++ error: no matching function for call to ..
-
Kann mir jemand helfe bei diesem Problem ?
Würde mich freuen wenn mir jemand einen tipp geben kann.[b]g++ main.cpp [/b] main.cpp: In function `int main()': main.cpp:35: error: no matching function for call to `strVokabeln::strVokabeln( std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)' Functions.h:11: error: candidates are: strVokabeln::strVokabeln() Functions.h:11: error: strVokabeln::strVokabeln(const strVokabeln&)
1 //--------------------------------------------------------------------------- 2 #include <iostream> 3 #include <fstream> 4 #include <string> 5 #include <vector> 6 7 #include "Functions.h" 8 //--------------------------------------------------------------------------- 9 using namespace std; 10 11 int main( ) 12 { 13 14 int iMaxLines; 15 string sFile; 16 int iAlgo = 0; 17 int iRound = 0; 18 19 ifstream myFile; 20 myFile.open ("test.txt"); 21 22 if(!myFile){ 23 cout << "Fehler beim Oeffnen der Datei!\n"; 24 exit(1); 25 } 26 27 //iMaxLines = getFileLines( myFile ); 28 vector < strVokabeln > Woerterbuch; 29 //Woerterbuch.resize(iMaxLines); 30 //Woerterbuch[1].sDeutsch 31 string zeile; 32 while(getline(myFile,zeile)) 33 { 34 size_t trenn = zeile.find(' '); 35 Woerterbuch.push_back(strVokabeln(zeile.substr(0,trenn),zeile.substr(trenn+1))); 36 } 37 //myVokabel = new strVokabeln[iMaxLines]; 38 39 40 /* 41 loadVokabeln(myFile, myVokabel, iMaxLines); 42 oneonetraining (myVokabel, &iMaxLines, iRound); 43 */ 44 45 myFile.close(); 46 Woerterbuch.clear(); 47 cin.get(); 48 return 0; 49 }
"Functions.h"
1 //--------------------------------------------------------------------------- 2 #include <iostream> 3 #include <fstream> 4 #include <string> 5 //--------------------------------------------------------------------------- 6 #define ALGO 0 7 #define ROUND 2 8 9 10 struct strVokabeln 11 { 12 std::string sDeutsch; 13 std::string sEnglisch; 14 }; 15 16 int getFileLines ( std::ifstream &myFile ); 17 void loadVokabeln ( std::ifstream &myFile, strVokabeln *myVocabulum, int &size); 18 void oneonetraining ( strVokabeln *myVocabulum, int *iMaxLines, int &Durchlaeufe); 19 int getRandomNumber ( int iMaxMumber ); 20 //void startparameter(char * argv[], int *iRound,int *iAlgo); 21 22
-
Wenn du das so aufrufen willst, braucht strVokabeln einen entsprechenden Konstruktor.
-
Dieser Thread wurde von Moderator/in rüdiger aus dem Forum Linux/Unix in das Forum C++ verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.