Próbuję do swojego programu wstawić vector. Niestety, nie za bardzo mi się udaje Wydaje mi się, że wszystko robię poprawnie. Zrobiłem przykładowy program, żeby sprawdzić czy to serio nie działa i aby to tutaj wam pokazać:
#include <std_lib_facilities.h>
vector <string> v(6);
v[0] = "test1";
v[1] = "test2";
v[2] = "test3";
v[3] = "test4";
v[4] = "test5";
v[5] = "test6";
int main()
{
cout << "TEST PROGRAM!\n" << v[0] << '\t' << v[1] << '\t' << v[2] << '\t' << v[3] << '\t' << v[4] << '\t' << v[5] << '\t'
return 0;
}
Przy próbie kompilacji dostaję dużo błędów (są bardzo podobne i większość się powtarza):
cannot allocate an array of constant size 0
missing type specifier - int assumed
'v' : 'int []' differs in levels of indirection from 'Vector<T>'
'initializing' : cannot convert from 'const char [6]' to 'int []'
1> There is no context in which this conversion is possible
Bardzo proszę o pomoc.
PS: Używam Visual C++ 2010 Express