Beginner learning vectors encountered 2 errors heres my source:
#include "std_lib_facilities.h"
int main()
{
std::cout << "Vector Example";
vector<int> v = {5,7,9,4,5,8};
for (int i=0; i<v.size(); ++i)
cout << v[i] << '\n';
}
Makefile:
main: booksource.cpp
g++ -std=c++11 -Wall -g booksource.cpp -o booksource
for header file please refer to http://ift.tt/1tXJ3Xt
First error:
/usr/include/c++/4.9/bits/locale_facets_nonio.h:1869:5: error: template-id ‘do_get<>’ for ‘String std::messages<char>::do_get(std::messages_base::catalog, int, int, const String&) const’ does not match any template declaration
messages<char>::do_get(catalog, int, int, const string&) const;
^
Second Error:
booksource.cpp: In function ‘int main()’:
booksource.cpp:5:29: error: could not convert ‘{5, 7, 9, 4, 5, 8}’ from ‘<brace-enclosed initializer list>’ to ‘Vector<int>’
vector<int> v = {5,7,9,4,5,8};
Aucun commentaire:
Enregistrer un commentaire