编译都过不了--小师妹的简单问题

wangjiamin 2003-02-24 04:26:47
用VC写程序,将LPTSTR类型的变量转换为LPCWSTR,程序如下:
#include "atlconv.h"

....
LPTSTR fileName = "e:\\water.mpg";
LPCWSTR f = T2W(fileName);

编译时说我包含的头文件中有很多错误,这些头文件都是VC提供的,不是我自己写的,应该没问题吧
这是怎么回事?
编译信息如下:
Compiling...
player.cpp
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(48) : error C2065: '_ASSERTE' : undeclared identifier
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(237) : error C2065: 'offsetof' : undeclared identifier
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(237) : error C2275: 'DEVMODEW' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\wingdi.h(1870) : see declaration of 'DEVMODEW'
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(237) : error C2065: 'dmFormName' : undeclared identifier
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(237) : error C2275: 'DEVMODEW' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\wingdi.h(1870) : see declaration of 'DEVMODEW'
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(237) : error C2065: 'dmSpecVersion' : undeclared identifier
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(240) : error C2275: 'DEVMODEW' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\wingdi.h(1870) : see declaration of 'DEVMODEW'
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(240) : error C2065: 'dmLogPixels' : undeclared identifier
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(350) : error C2275: 'DEVMODEA' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\wingdi.h(1825) : see declaration of 'DEVMODEA'
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(350) : error C2275: 'DEVMODEA' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\wingdi.h(1825) : see declaration of 'DEVMODEA'
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(353) : error C2275: 'DEVMODEA' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\wingdi.h(1825) : see declaration of 'DEVMODEA'
E:\vc project\player\player.cpp(210) : error C2065: '_lpa' : undeclared identifier
E:\vc project\player\player.cpp(210) : error C2440: '=' : cannot convert from 'char *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
E:\vc project\player\player.cpp(210) : error C2065: '_convert' : undeclared identifier
Error executing cl.exe.

player.obj - 14 error(s), 0 warning(s)
...全文
163 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
coyer 2003-02-25
  • 打赏
  • 举报
回复
向小师妹学习。
cboy2wzhx 2003-02-25
  • 打赏
  • 举报
回复
UP
Earthdog 2003-02-25
  • 打赏
  • 举报
回复
同意ruihuahan(飞不起来的笨鸟)

在使用T2W宏的函数的开头加如下语句:

USES_CONVERSION;
见招拆招 2003-02-25
  • 打赏
  • 举报
回复
楼主的问题 解决了没有
skybblue 2003-02-24
  • 打赏
  • 举报
回复
把 #include "atlconv.h" 改成 #include "atlbase.h" 就行了!
phiger 2003-02-24
  • 打赏
  • 举报
回复
add line USES_CONVERSION;
at the start of function!
ruihuahan 2003-02-24
  • 打赏
  • 举报
回复
在使用T2W宏的函数的开头加如下语句:

USES_CONVERSION;
AVactress 2003-02-24
  • 打赏
  • 举报
回复
在前面加
#include <stddef.h>
xystarch 2003-02-24
  • 打赏
  • 举报
回复
缺少头文件吧!

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧