c++ - Need help creating a simple console program that uses a header file I wrote -


I'm really sad on this, so I can actually use some help.

I created a new project in Visual Studio, I created a new header file for the first time, which was called "Mysterrine, H" and placed it in the header folder. It contains a class named String. You can see the code used for it at the end of this

Now let me start mystring.txt in the source file folder. CP file is It has the following code in it.

  #include & lt; Iostream & gt; # Include "MyString.h" using the name std; Int main () {string obj = "hello"; Cout & lt; & Lt; Obj (1,3); }   

Expected: The program that runs the console program will be "llo": Reality: Error: 'Identifier string' is undefined

Here are some code in my header file In ... I really can not fit it in everyone.

  // 1 preprocessor command - Include files for the Guard string method against file and many inversions of MyString.h #ifdef __MYSTRING_H__ #define __MYSTRING_H_ #define _CRT_SECURE_NO_DEPRECATE #define _CRT_NONSTDC_NO_DEPRECATE / 2 and include & Lt; Cstring & gt; // strlen, strcpy, strcmp # include & lt; Cassert & gt; // Insert # include & lt; Iostream & gt; // COAT; CID using Nanospace; // 3 String Class Interface Class String {// Start 4. Define Public Members: // 5 Default Creator String (); // 6 The creator that converts into a four * string object string (const char * s);   

....

A little mistake line in the first code : You need

  #ifndef __MYSTRING_H__   

; Otherwise you leaving sill all your file content #endif

Comments