Can't get this test program to compile on Dev 4.9.7.0./gcc 3.2.
#include <algorithm> #include <cstdlib> #include <iostream> #include <vector>
using namespace std;
vector<int>v; int num = 10000;
int main() { for(int i= 0; i< num; ++i) { v.push_back(rand()); } vector<int>::iterator it = v.max_element(v.begin(), v.end()); cout << endl << endl; system("PAUSE");
return 0; }
Anyone want to point out the stupid mistake I've made, or failing that run it on their machine?
Derek
output on dev 4.9.6.9 gcc version 2.95.3-6 (mingw special)
18 K:\Documents and Settings\lenhan\Desktop\Untitled1.cpp no matching function for call to `vector<int,allocator<int> >::max_element (int *, int *)'
might not be a compiler problem.
Nhan
Thanks Nhan,
It's not too much of a problem as the manual code is easy to write,but it's part of the standard library so slightly worrying that it is missing.
Log in to post a comment.
Can't get this test program to compile on Dev 4.9.7.0./gcc 3.2.
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
vector<int>v;
int num = 10000;
int main()
{
for(int i= 0; i< num; ++i)
{
v.push_back(rand());
}
vector<int>::iterator it = v.max_element(v.begin(), v.end());
cout << endl << endl;
system("PAUSE");
return 0;
}
Anyone want to point out the stupid mistake I've made, or failing that run it on their machine?
Derek
output on dev 4.9.6.9
gcc version 2.95.3-6 (mingw special)
18 K:\Documents and Settings\lenhan\Desktop\Untitled1.cpp
no matching function for call to `vector<int,allocator<int> >::max_element (int *, int *)'
might not be a compiler problem.
Nhan
Thanks Nhan,
It's not too much of a problem as the manual code is easy to write,but it's part of the standard library so slightly worrying that it is missing.
Derek