|
|
lines 34 and 35
as shown below:
|
|
Compiler: Default compiler Executing g++.exe... g++.exe "C:\Users\Kolly\Desktop\DS4-4.cpp" -o "C:\Users\Kolly\Desktop\DS4-4.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" C:\Users\Kolly\Desktop\DS4-4.cpp: In function `void reverseVector(std::vector<elemType, std::allocator<_CharT> >&)': C:\Users\Kolly\Desktop\DS4-4.cpp:34: error: expected `;' before "iter1" C:\Users\Kolly\Desktop\DS4-4.cpp:35: error: expected `;' before "iter2" C:\Users\Kolly\Desktop\DS4-4.cpp:41: error: `iter1' undeclared (first use this function) C:\Users\Kolly\Desktop\DS4-4.cpp:41: error: (Each undeclared identifier is reported only once for each function it appears in.) C:\Users\Kolly\Desktop\DS4-4.cpp:42: error: `iter2' undeclared (first use this function) C:\Users\Kolly\Desktop\DS4-4.cpp: In function `void reverseVector(std::vector<elemType, std::allocator<_CharT> >&) [with elemType = int]': C:\Users\Kolly\Desktop\DS4-4.cpp:15: instantiated from here C:\Users\Kolly\Desktop\DS4-4.cpp:34: error: dependent-name ` std::vector<elemType,std::allocator<_CharT> >::iterator' is parsed as a non-type, but instantiation yields a type C:\Users\Kolly\Desktop\DS4-4.cpp:34: note: say `typename std::vector<elemType,std::allocator<_CharT> >::iterator' if a type is meant C:\Users\Kolly\Desktop\DS4-4.cpp:35: error: dependent-name ` std::vector<elemType,std::allocator<_CharT> >::reverse_iterator' is parsed as a non-type, but instantiation yields a type C:\Users\Kolly\Desktop\DS4-4.cpp:35: note: say `typename std::vector<elemType,std::allocator<_CharT> >::reverse_iterator' if a type is meant Execution terminated |
lines 34 and 35
? At least, that is what was passed into the function.
|
|
|
|
|
|
note: say `typename std::vector<elemType,std::allocator<_CharT> >::reverse_iterator' if a type is meant |
(B<T>::Pqr y; )Unfortunately this doesn’t work either because those names (are you ready? are you sitting down?) are not necessarily types.(...) the compiler cannot assume that B<T>::Xyz is a type until it knows T. The solution is to give the compiler a hint via the typename keyword: |
lines 34 and 35
with the keyword typename
.