g++-3.0 question
I'm not a C++ hacker, and would appreciate any help on this.
In preparation for g++-3.0, I setup a Debian unstable chroot tree
on a friend's Red Hat system. He is upstream for the `gri'
package. It currently doesn't build on g++-3.0, and he wanted to
port the code.
He is stuck on a problem:
: The attached program FAILS TO COMPILE for g++ version 3 (on a trial
: debian system), but it COMPILES OK for g++ version 2.96 (on
: linux/redhat7.0). The error is:
:
: test.cc: In function `void sub2()':
: test.cc:24: `reverse' undeclared (first use this function)
:
: Any advice on how to change the code?
:
: Thanks!
---
#include <algorithm>
#include <vector.h>
#include <stdio.h>
void sub1();
void sub2();
int main(){
sub1();
sub2();
}
void sub1() {
vector<double> s;
for (int i = 0; i < 3; i++)
s.push_back(0.1 * i);
reverse(s.begin(), s.end());
}
void sub2() {
double s[3];
for (int i = 0; i < 3; i++)
s[i] = 0.11 * i;
reverse(s, s + 3);
---
Thanks.
Peter
Reply to: