简单的宽字符转换,头文件报错
想做wchar_t转换,但是一包含这个#include <winnls.h>头文件就报错,不知道为何。
#include <iostream>
#include <stdlib.h>
#include <string>
#include <wchar.h>
#include <winnls.h>
#define MAX_PATH 100
using namespace std;
int main(void)
{
wchar_t strPath[MAX_PATH];
char buf[] = "函数集,fun 1";
mbstowcs( strPath, buf, MAX_PATH );
MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf), strPath, MAX_PATH );
cout<<strPath<<endl;
for(int i;i<MAX_PATH;i++)
cout<<strPath[i]<< " ";
return 0;
}
error C2146: syntax error : missing ';' before identifier 'LCTYPE'
include\winnls.h(616) : fatal error C1004: unexpected end of file found
为何头文件会出错??
#include <iostream>
#include <stdlib.h>
#include <string>
#include <wchar.h>
#include <winnls.h>
#define MAX_PATH 100
using namespace std;
int main(void)
{
wchar_t strPath[MAX_PATH];
char buf[] = "函数集,fun 1";
mbstowcs( strPath, buf, MAX_PATH );
MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf), strPath, MAX_PATH );
cout<<strPath<<endl;
for(int i;i<MAX_PATH;i++)
cout<<strPath[i]<< " ";
return 0;
}
error C2146: syntax error : missing ';' before identifier 'LCTYPE'
include\winnls.h(616) : fatal error C1004: unexpected end of file found
为何头文件会出错??
...全文
相关推荐
C++常用头文件简介及编译错误大全
C++头文件罗列,并具体讲解一些常用头文件的具体内容。详细介绍了C2001到C2099的编译错误
解决WCHAR.H报错:宽字符、Windows SDK与Unicode路径处理实战
宽字符处理是Windows C/C++开发中绕不开的环节,而WCHAR.H作为Windows SDK定义宽字符类型的关键头文件,常因包含路径配置不当引发编译报错。理解WCHAR与标准wchar_t的别名关系,掌握宽字符函数与ANSI函数的对应转换,是处理Unicode文件名和中文路径的基础。通过正确配置Visual Studio或C-Free的SDK包含目录,调用FindFirstFileW、_wfopen等宽字符API,可以有效避免乱码与类型冲突。本文围绕WCHAR.H的定位、使用场景与排错方法展开,帮助
CC++头文件一览
头文件一览,不太全,不要钱,下了随便看~_~
stdint.h兼容C语言头文件
stdint.h兼容C语言头文件
C语言编译器常见错误编码大全
C语言的错误代码大全C语言的错误代码大全C语言的错误代码大全C语言的错误代码大全C语言的错误代码大全C语言的错误代码大全。


新手乐园
