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. Why this typedef not working

Why this typedef not working

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 3 Posters 6 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.
  • J Offline
    J Offline
    John theKing
    wrote on last edited by
    #1

    I am getting many errors in the following code: #ifdef _UNICODE typedef std::wcout _tcout; #else typedef std::cout _tcout; #endif But i am not getting any error in this code: #ifdef _UNICODE typedef std::wstring _tstring; #else typedef std::string _tstring; #endif Can anyone tell me what is the problem in the first case, because i am getting 8 errors. I am copying first error below: c:\documents and settings\tstring.h(22) : error C2146: syntax error : missing ';' before identifier '_tcout' Yes, Yes i am including all header files like iostream e.t.c

    R J 2 Replies Last reply
    0
    • J John theKing

      I am getting many errors in the following code: #ifdef _UNICODE typedef std::wcout _tcout; #else typedef std::cout _tcout; #endif But i am not getting any error in this code: #ifdef _UNICODE typedef std::wstring _tstring; #else typedef std::string _tstring; #endif Can anyone tell me what is the problem in the first case, because i am getting 8 errors. I am copying first error below: c:\documents and settings\tstring.h(22) : error C2146: syntax error : missing ';' before identifier '_tcout' Yes, Yes i am including all header files like iostream e.t.c

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      didn't you forget an #include <iostream> somewhere ? ~RaGE();

      J 1 Reply Last reply
      0
      • R Rage

        didn't you forget an #include <iostream> somewhere ? ~RaGE();

        J Offline
        J Offline
        John theKing
        wrote on last edited by
        #3

        Rage wrote: didn't you forget an #include somewhere ? Yes, i am including it, and still getting errors.

        1 Reply Last reply
        0
        • J John theKing

          I am getting many errors in the following code: #ifdef _UNICODE typedef std::wcout _tcout; #else typedef std::cout _tcout; #endif But i am not getting any error in this code: #ifdef _UNICODE typedef std::wstring _tstring; #else typedef std::string _tstring; #endif Can anyone tell me what is the problem in the first case, because i am getting 8 errors. I am copying first error below: c:\documents and settings\tstring.h(22) : error C2146: syntax error : missing ';' before identifier '_tcout' Yes, Yes i am including all header files like iostream e.t.c

          J Offline
          J Offline
          Joaquin M Lopez Munoz
          wrote on last edited by
          #4

          std::cout is not a type, but an object, so you cannot use it in a typedef declaration. It is as if you write:

          int a;
          typedef a b; //no way!

          Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

          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