error syntax c++

1
2
3
4
5
6
7
8
9
10
for( const auto& i : myvector ) // i
    {
        int colone = 0;
        for( auto j : i) // j : i
        {
            R[ligne*maxCardinalite+colone] = j; // i
            colone++;
        }
        ligne++;
    }

I get the following errors. Can you help me please?
settings\client\bureau\essai\presence\presence\source3.cc(72): error C2143: syntax error : missing ',' before ':' 1>c:\documents and settings\client\bureau\essai\presence\presence\source3.cc(72): error C2530: 'i' : references must be initialized 1>c:\documents and settings\client\bureau\essai\presence\presence\source3.cc(72): error C3531: 'i': a symbol whose type contains 'auto' must have an initializer 1>c:\documents and settings\client\bureau\essai\presence\presence\source3.cc(73): error C2143: syntax error : missing ';' before '{' 1>c:\documents and settings\client\bureau\essai\presence\presence\source3.cc(75): error C2143: syntax error : missing ',' before ':' 1>c:\documents and settings\client\bureau\essai\presence\presence\source3.cc(75): error C3531: 'j': a symbol whose type contains 'auto' must have an initializer 1>c:\documents and settings\client\bureau\essai\presence\presence\source3.cc(76): error C2143: syntax error : missing ';' before '{' 1>
Does your compiler support C++11 ranged for syntax?
No. ! So what is the solution ?
Last edited on
The older for-loop syntax. Note though that the auto (as used above) is a C++11 keyword too and thus cannot be used.
Topic archived. No new replies allowed.