[linux] hulp gevraagd bij compileren mastermind

Paul de Vries paul.de.vries op xs4all.nl
Zo mei 3 15:21:10 CEST 2020


na 

git clone https://github.com/nattydredd/Mastermind-Five-Guess-Algorithm.git

wil ik het programma compileren met

g++     Five-Guess-Algorithm.cpp   -o Five-Guess-Algorithm

maar dat lukt niet. hoe moet het wel?

log:

Five-Guess-Algorithm.cpp:17:34: error: ‘>>’ should be ‘> >’ within a nested template argument list
 void removeCode(vector<vector<int>> &set, vector<int> code);
                                  ^
Five-Guess-Algorithm.cpp:19:34: error: ‘>>’ should be ‘> >’ within a nested template argument list
 void pruneCodes(vector<vector<int>> &set, vector<int> code, string currentResponse);
                                  ^
Five-Guess-Algorithm.cpp:21:18: error: ‘>>’ should be ‘> >’ within a nested template argument list
 vector<vector<int>> minmax();
                  ^
Five-Guess-Algorithm.cpp:27:43: error: ‘>>’ should be ‘> >’ within a nested template argument list
 vector<int> getNextGuess(vector<vector<int>> nextGuesses);
                                           ^
Five-Guess-Algorithm.cpp:31:25: error: ‘>>’ should be ‘> >’ within a nested template argument list
 static vector<vector<int>> combinations; //Master set of combinations 1111 to 6666
                         ^
Five-Guess-Algorithm.cpp:32:25: error: ‘>>’ should be ‘> >’ within a nested template argument list
 static vector<vector<int>> candidateSolutions;
                         ^
Five-Guess-Algorithm.cpp:33:25: error: ‘>>’ should be ‘> >’ within a nested template argument list
 static vector<vector<int>> nextGuesses;
                         ^
Five-Guess-Algorithm.cpp: In function ‘int main()’:
Five-Guess-Algorithm.cpp:46:31: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
     currentGuess = {1, 1, 2, 2}; //1122
                               ^
Five-Guess-Algorithm.cpp:46:18: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
     currentGuess = {1, 1, 2, 2}; //1122
                  ^
Five-Guess-Algorithm.cpp:46:18: error: no match for ‘operator=’ (operand types are ‘std::vector<int>’ and ‘<brace-enclosed initializer list>’)
Five-Guess-Algorithm.cpp:46:18: note: candidate is:
In file included from /usr/include/c++/4.8.2/vector:69:0,
                 from Five-Guess-Algorithm.cpp:2:
/usr/include/c++/4.8.2/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]
     vector<_Tp, _Alloc>::
     ^
/usr/include/c++/4.8.2/bits/vector.tcc:160:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const std::vector<int>&’
Five-Guess-Algorithm.cpp: At global scope:
Five-Guess-Algorithm.cpp:174:34: error: ‘>>’ should be ‘> >’ within a nested template argument list
 void removeCode(vector<vector<int>> &set, vector<int> currentCode) {
                                  ^
Five-Guess-Algorithm.cpp: In function ‘void removeCode(std::vector<std::vector<int> >&, std::vector<int>)’:
Five-Guess-Algorithm.cpp:177:15: error: ‘it’ does not name a type
     for (auto it = set.begin(); it != set.end(); it++) {
               ^
Five-Guess-Algorithm.cpp:177:33: error: expected ‘;’ before ‘it’
     for (auto it = set.begin(); it != set.end(); it++) {
                                 ^
Five-Guess-Algorithm.cpp:177:33: error: ‘it’ was not declared in this scope
Five-Guess-Algorithm.cpp: At global scope:
Five-Guess-Algorithm.cpp:187:34: error: ‘>>’ should be ‘> >’ within a nested template argument list
 void pruneCodes(vector<vector<int>> &set, vector<int> currentCode, string currentResponse) {
                                  ^
Five-Guess-Algorithm.cpp: In function ‘void pruneCodes(std::vector<std::vector<int> >&, std::vector<int>, std::string)’:
Five-Guess-Algorithm.cpp:190:22: error: ‘>>’ should be ‘> >’ within a nested template argument list
     vector<vector<int>>::iterator it = set.begin();
                      ^
Five-Guess-Algorithm.cpp: At global scope:
Five-Guess-Algorithm.cpp:203:18: error: ‘>>’ should be ‘> >’ within a nested template argument list
 vector<vector<int>> minmax() {
                  ^
Five-Guess-Algorithm.cpp: In function ‘std::vector<std::vector<int> > minmax()’:
Five-Guess-Algorithm.cpp:207:22: error: ‘>>’ should be ‘> >’ within a nested template argument list
     vector<vector<int>> nextGuesses;
                      ^
Five-Guess-Algorithm.cpp:218:28: error: ‘class std::map<std::basic_string<char>, int>’ has no member named ‘emplace’
                 scoreCount.emplace(pegScore, 1);
                            ^
Five-Guess-Algorithm.cpp:223:15: error: ‘class std::map<std::vector<int>, int>’ has no member named ‘emplace’
         score.emplace(combinations[i], max);
               ^
Five-Guess-Algorithm.cpp:229:15: error: ‘elem’ does not name a type
     for (auto elem : score) {
               ^
Five-Guess-Algorithm.cpp:235:5: error: expected ‘;’ before ‘return’
     return nextGuesses;
     ^
Five-Guess-Algorithm.cpp:235:5: error: expected primary-expression before ‘return’
Five-Guess-Algorithm.cpp:235:5: error: expected ‘;’ before ‘return’
Five-Guess-Algorithm.cpp:235:5: error: expected primary-expression before ‘return’
Five-Guess-Algorithm.cpp:235:5: error: expected ‘)’ before ‘return’
Five-Guess-Algorithm.cpp: In function ‘int getMaxScore(std::map<std::basic_string<char>, int>)’:
Five-Guess-Algorithm.cpp:241:15: error: ‘elem’ does not name a type
     for (auto elem : inputMap) {
               ^
Five-Guess-Algorithm.cpp:247:5: error: expected ‘;’ before ‘return’
     return max;
     ^
Five-Guess-Algorithm.cpp:247:5: error: expected primary-expression before ‘return’
Five-Guess-Algorithm.cpp:247:5: error: expected ‘;’ before ‘return’
Five-Guess-Algorithm.cpp:247:5: error: expected primary-expression before ‘return’
Five-Guess-Algorithm.cpp:247:5: error: expected ‘)’ before ‘return’
Five-Guess-Algorithm.cpp: In function ‘int getMinScore(std::map<std::vector<int>, int>)’:
Five-Guess-Algorithm.cpp:252:15: error: ‘numeric_limits’ was not declared in this scope
     int min = numeric_limits<int>::max();
               ^
Five-Guess-Algorithm.cpp:252:30: error: expected primary-expression before ‘int’
     int min = numeric_limits<int>::max();
                              ^
Five-Guess-Algorithm.cpp:253:15: error: ‘elem’ does not name a type
     for (auto elem : inputMap) {
               ^
Five-Guess-Algorithm.cpp:259:5: error: expected ‘;’ before ‘return’
     return min;
     ^
Five-Guess-Algorithm.cpp:259:5: error: expected primary-expression before ‘return’
Five-Guess-Algorithm.cpp:259:5: error: expected ‘;’ before ‘return’
Five-Guess-Algorithm.cpp:259:5: error: expected primary-expression before ‘return’
Five-Guess-Algorithm.cpp:259:5: error: expected ‘)’ before ‘return’
Five-Guess-Algorithm.cpp: At global scope:
Five-Guess-Algorithm.cpp:262:43: error: ‘>>’ should be ‘> >’ within a nested template argument list
 vector<int> getNextGuess(vector<vector<int>> nextGuesses) {
                                           ^
make: *** [Five-Guess-Algorithm] Error 1



Meer informatie over de Linux maillijst