I see there's an OpenVMS C language reference but no C++ language reference, I'd imagine this isn't an oversight so what guide should be used for reference?
For example I'm trying to use a simple auto for loop to see what I can do but I'm getting errors...
https://en.cppreference.com/w/cpp/language/range-for
I'm trying to use the C++11 standard but not sure what compiler args I need?
Code: Select all
#include <iostream>
#include <vector>
using namespace std;
int main()
{
std::vector<int> v = {0, 1, 2, 3, 4, 5};
for (auto i : v) // access by value, the type of i is int
cout << i << ' ';
cout << '\n';
return 0;
}
Code: Select all
std::vector<int> v = {0, 1, 2, 3, 4, 5};
.........................^
%CXX-E-BRACEINIT, initialization with "{...}" is not allowed for object
of type "std::vector<int, std::allocator<int>>"
at line number 8 in file MYROOT:[dev.cxx]auto.cxx;4
for (auto i : v) // access by value, the type of i is int
..............^
%CXX-W-NOSIMPINT, omission of explicit type is nonstandard ("int" assumed)
at line number 10 in file MYROOT:[dev.cxx]auto.cxx;4
for (auto i : v) // access by value, the type of i is int
................^
%CXX-E-EXPSEMICOLON, expected a ";"
at line number 10 in file MYROOT:[dev.cxx]auto.cxx;4
for (auto i : v) // access by value, the type of i is int
...................^
%CXX-E-EXPPRIMEXPR, expected an expression
at line number 10 in file MYROOT:[dev.cxx]auto.cxx;4
for (auto i : v) // access by value, the type of i is int
...................^
%CXX-E-EXPSEMICOLON, expected a ";"
at line number 10 in file MYROOT:[dev.cxx]auto.cxx;4
%CXX-I-MESSAGE, 4 errors detected in the compilation of "MYROOT:[dev.cxx]auto.cxx;4".
Gary