www.digitalmars.com         C & C++   DMDScript  

c++.chat - Getting the string type to work

reply %u Craig Nelson <cnelson ccp.edu> writes:
I have just downloaded DM C++, while testing out the features I
seem to be stuck getting the string type to work. I have
 #include <string.h>
and
string str;
in the main function.  the compiler feeds back that string is an
unidentified identifier. I have even tried to use std::string str;
and still get an error.  I want to make sure these basic fucntions
work properly before purchasing the whole kit.
Sep 12 2008
parent reply Bryan Power <bp2626 yahoo.com> writes:
%u Craig Nelson wrote:
 I have just downloaded DM C++, while testing out the features I
 seem to be stuck getting the string type to work. I have
  #include <string.h>
 and
 string str;
 in the main function.  the compiler feeds back that string is an
 unidentified identifier. I have even tried to use std::string str;
 and still get an error.  I want to make sure these basic fucntions
 work properly before purchasing the whole kit.
Hi Craig, Both test cases: ------------------------------ #include <string> std::string globalS; int main() { std::string localS; return 0; } ------------------------------ and: ------------------------------ #include <string> using namespace std; string globalS; int main() { string localS; return 0; } ------------------------------ Compile without error for me. Are you sure you have stlport installed? Your sc.ini INCLUDE variable should look something like: INCLUDE="% P%\..\stlport\stlport";"% P%\..\include";"% P%\..\mfc\include";%INCLUDE%
Sep 21 2008
parent Gutta <gutta999 msn.com> writes:
Good Morning Sir, My name is Gutta. I'm from India. coming to the
issue,  The header files are i.e stdio.h, conio.h, string.h......
If we want to use those files, Just we have to mention at starting
of the program. i.e #include<string.h>. need not to call them into
programming. i.e std::string local();
But if you creat a header file. i.e for user defined header files,
we need to call them at the execution.
For example, if you create a header file i.e gutta.
#include<gutta.h>
if you want to use the functions of the gutta header file. then
you need to call like
obj::gutta function();
Where obj is the current object name.with the object name "obj",
we called the function() of gutta header file.
"gutta" is a user defiened header file.
I thought you got my point. still you have doubts on it. send me a
message to my msn id. "gutta999 msn.com". Thank you Sir.
Nov 17 2008