error: back_insertor is not a member of std
Bonjour,
quelqu'un peut-il m'aider à diagnostiquer mon problème ? Sois je commets une grossière erreur de C++ soit j'ai un conflit (voir log de compil'). J'ai compilé et installé sous /opt GCC5.1 ; mon système a GCC4.4 d'installé (/usr/). Ce peut-il que /opt/bin/g++ cherche les includes dans /usr/include ?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| ysc@ysc:/tmp$ cat > test.cpp
#include <cstdlib>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
int main(void) {
std::string result;
std::vector<std::string> vector{"Hello", ",", " ", "World", "!"};
std::copy(vector.begin(), vector.end(), std::back_insertor(result));
std::cout << result << std::endl;
return 0;
}
ysc@ysc:/tmp$ /opt/bin/g++ --version
g++ (GCC) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ysc@ysc:/tmp$ /opt/bin/g++ -std=c++11 -Wall -Wextra -Werror -O2 -g test.cpp -o test.bin
test.cpp: In function int main() :
test.cpp:9:42: error: back_insertor is not a member of std
std::copy(vector.begin(), vector.end(), std::back_insertor(result));
^
ysc@ysc:/tmp$ |
Merci de votre aide.