Why this typedef not working
-
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
-
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
-
Rage wrote: didn't you forget an #include somewhere ? Yes, i am including it, and still getting errors.
-
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
std::cout
is not a type, but an object, so you cannot use it in atypedef
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