stringstream error

Im getting an error on line 17: "std::stringstream convert" has incomplete type and cannot be defined. Not sure what the problem is. Any help would be appreciated. Edit: Iv'e used this function before in other routines and it worked perfectly. The function int_to_string takes an int(or long in this case) and converts it to a string. *scratches chin*
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using namespace std;
int totalSum = 0; //Global variable

long process_num(string pString, int origin_num){
    long sum = 0;
    for (int i = 0; i != pString.size(); i++){
        char temp = (pString[i]);
        int temp_num = temp - '0';
        sum += pow(temp_num, 5);
    }
    if (sum == origin_num)
        return sum;
    else
        return 0;
}
string int_to_string(long number){
    
	stringstream convert;
	convert << number;
	return convert.str();
}
int main()
{
     string Num_string;
     int total = 0;
     for(long i = 10; i <= 2000000; i++){
         Num_string = int_to_string(i);
         total = process_num(Num_string, i);
         totalSum += total;
     }
     return totalSum;
}

Last edited on
Try another variable name, see what happens.
Did you forget to include <sstream>?
mordoran: I tried another variable aready. Same thing.
Peter87: DOH! Forgot <sstream> :( (it works now)
Thanks for the help and input from both of you.
Aries

PS Always seems to help to have a fresh set of eyes. Thanks again.
Topic archived. No new replies allowed.