我想问一下TCHAR.h例程未定义 [英] I want ask about TCHAR.h routine is undefined
本文介绍了我想问一下TCHAR.h例程未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#define _WIN32_WINNT 0x0500 //for define Character Sets ID
#include "windows.h"
#include "string.h"
#include "stdio.h"
#include "locale.h"
#include "tchar.h"
//set windows code page 1252 Latin1 for TextOutA
_tsetlocale (LC_ALL, _TEXT ("german_germany.1252")) ;
编译时,我从cl.exe(VC ++ 6.0/WindowsXP sp2)中得到错误
它说_tsetlocale是undefined
.
我还尝试了其他所有TCHAR.h例程(_tcsclen等)
但它仍然给我同样的错误.
我希望有人能告诉我哪里错了吗?
When I compile , I got an Error from cl.exe (VC++ 6.0 / windowsXP sp2)
it says _tsetlocale is undefined
.
I also tried other all the TCHAR.h routine (_tcsclen and so on)
but it still gives me the same error.
I wish someone could tell me Where is wrong ?
推荐答案
_tsetlocale
似乎没有定义,请参见 ^ ]中的可用选项.
There does not appear to be a definition for _tsetlocale
, see here[^] for the available options.
当我尝试您的代码时( VC ++ 6,WinXP sp3),它可以正常编译.错误的确切措辞是什么?
error LNK2001: unresolved external symbol _setlocale
表示您没有链接 C运行时库 [ ^ ].
error C2065: ''_tsetlocale'' : undeclared identifier
表示未读取#define.我可能想到的一种可能原因是读取了错误的TChar.h.您使用带引号的包含而不是尖括号包含,这意味着它会先搜索您的项目目录,然后再搜索编译器的包含路径.
您可以尝试在#include中对路径进行硬编码,以消除这种可能性;
When I try your code (VC++ 6, WinXP sp3), it compiles just fine. What is the exact wording of the error?
error LNK2001: unresolved external symbol _setlocale
would indicate you didn''t link a C run time library[^].
error C2065: ''_tsetlocale'' : undeclared identifier
would imply the #define hasn''t been read. One possibility I could think of that would cause this is that the wrong TChar.h has been read. You use a quoted include rather than an angle-bracket include, which means it first scans your project directory before searching in the compiler''s include path.
You could try hardcoding the path in the #include to eliminate this possibility;
#include "C:/Program Files/Microsoft Visual Studio/VC98/Include/TChar.h"
这篇关于我想问一下TCHAR.h例程未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文