Tuesday, November 3, 2020

error message: tchar is not defined

when I compiled the code "matrix library in C", I got following similar error messages. So I did research and find the solution to it.

tchar is not defined
_tchar is undefined
Error C3861 'printf': identifier not found MatrixLib c:\demo_cpp\matrixlib\matrixlib\matlib.h 16

another error is:
‘RAND_MAX’ undeclared (first use in this function)

  1. Why do I receive this error when generating a random float?
  2. TCHAR vs _TCHAR
  3. TCHAR and _TCHAR are identical, although since TCHAR doesn't have a leading underscore, Microsoft aren't allowed to reserved it as a keyword (imagine if you had a variable called TCHAR. Think what would happen). Hence TCHAR will not be #defined when Language Extensions are disabled (/Za).

    TCHAR is defined in winnt.h (which you'll get when you #include ), and also tchar.h under /Ze. _TCHAR is available only in tchar.h (which also #defines _TSCHAR and _TUCHAR). Those are unsigned/signed variants of the normal TCHAR data type.

    You've probably already read it, but just in case, the strings section of Codeproject has useful info.

  4. Articles by Michael Dunn (Articles: 68)
  5. String handling
  6. CString Management
  7. The Complete Guide to C++ Strings, Part I - Win32 Character Encodings
  8. The Complete Guide to C++ Strings, Part II - String Wrapper Classes
  9. The Code Project Visual C++ Forum FAQ
  10. Some Time-Saving Commands and Key Remappings for the VC IDE

No comments:

Post a Comment