tags:

views:

151

answers:

2

i want to use unmanaged C++

std::string nodename[100];

this command give following error even though i use #include"string.h" also

'std' : is not a class or namespace name

+8  A: 

Try something like:

#include <string>

int main(void)
{
    std::string nodeName[100];
}

It's just string, not string.h.

GMan
+14  A: 

You're using the wrong header file. You should be #includeing <string>, not "string.h":

  • <string> is the header file that defines the C++ STL class std::string
  • <string.h> is the header file for the C standard library of string functions, which operate on C strings (char *)
  • <cstring> is the header file like <string.h>, but it declares all of the C string functions inside of the std namespace

For system header files like these, you should always #include them with angle brackets, not with double quotes.

Adam Rosenfield