0

I upgraded to vs2008 and now I can delcare and int, bool, or any primative data type, but when I delare a string it wont let me.

int ip; Works
char ip; Works

string ip; DOES NOT WORK

I get these three errors.

error C2146: syntax error : missing ';' before identifier 'ip
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

4
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by Nosgammot
0

It gets included by default.

really?

With

#include <iostream>
using namespace std;

some of the string functionality is available. But not all. I can allocate and assign strings, and access string function. But curiously, iostream overloads are not available with including <string>.

I suppose it's a matter of what you're defining as "by default".

0
#include<string> 
using namespace std;

I reckon you should try it even if you think it is included by default, it may be the answer.

Also, check all your ;'s are in the correct places.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.