Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. string var help

string var help

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpcomalgorithms
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    trask899
    wrote on last edited by
    #1

    Hello, I am just using Visual c++ 6.0 for the first time. I am trying to use a string variable, I set up #include and my variable is string player1; I am getting 3 errors, all of which around this error, 'string' : undeclared identifier. I have been searching microsoft.com, I can't find a solution, I hope someone will help me. Thank you.

    T Z 2 Replies Last reply
    0
    • T trask899

      Hello, I am just using Visual c++ 6.0 for the first time. I am trying to use a string variable, I set up #include and my variable is string player1; I am getting 3 errors, all of which around this error, 'string' : undeclared identifier. I have been searching microsoft.com, I can't find a solution, I hope someone will help me. Thank you.

      T Offline
      T Offline
      trask899
      wrote on last edited by
      #2

      PS I meant to put #include

      B J 2 Replies Last reply
      0
      • T trask899

        PS I meant to put #include

        B Offline
        B Offline
        bryce
        wrote on last edited by
        #3

        CString myString; ? Bryce --- Publitor, making Pubmed easy. http://www.sohocode.com/publitor

        1 Reply Last reply
        0
        • T trask899

          Hello, I am just using Visual c++ 6.0 for the first time. I am trying to use a string variable, I set up #include and my variable is string player1; I am getting 3 errors, all of which around this error, 'string' : undeclared identifier. I have been searching microsoft.com, I can't find a solution, I hope someone will help me. Thank you.

          Z Offline
          Z Offline
          ZoogieZork
          wrote on last edited by
          #4

          string is in the std namespace, so you either need to qualify it as std::string or add using std::string; before you first use it. using namespace std; will import the entire std namespace. - Mike

          T 1 Reply Last reply
          0
          • T trask899

            PS I meant to put #include

            J Offline
            J Offline
            Jijo Raj
            wrote on last edited by
            #5

            take care this point, while including the header for string class, use

            #include <string>
            

            don't use, #include "string.h" it wont work. Regards, Jijo. ;) ________________________________ Yesterday is history, Tomorrow is a mystery, But today is a present.

            1 Reply Last reply
            0
            • Z ZoogieZork

              string is in the std namespace, so you either need to qualify it as std::string or add using std::string; before you first use it. using namespace std; will import the entire std namespace. - Mike

              T Offline
              T Offline
              trask899
              wrote on last edited by
              #6

              Thanks a lot, I was able to get it up and running.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups