_skyfly

我不要在IT中迷失方向

VC8问题:升级后重编译程序,atlplus.h无法识别CStringW,请问各位是否遇到同类问题(此贴原载CSDN)


系统在VC7.1下开发,一直没问题,最近升级到VC8,然后重新编译,报如下错误:

d:\program files\microsoft visual studio 8\vc\atlmfc\include\atlplus.h(647) : error C2065: 'CStringW' : undeclared identifier
d:\program files\microsoft visual studio 8\vc\atlmfc\include\atlplus.h(647) : error C2146: syntax error : missing ';' before identifier 'strW'
d:\program files\microsoft visual studio 8\vc\atlmfc\include\atlplus.h(647) : error C3861: 'strW': identifier not found

但是在atlplus.h中明明已经include过atlstr.h:
...
#include <shellapi.h>
#include "atlevent.h"
#include <cstringt.h>
#include <atlstr.h>
//Avoid using <atlstr.h> except in the registry templates (for circular dependencies).

[
provider(name="ATL4", uuid="BC6B4B8A-0E4A-4bc9-B319-9DC2ACFB61EE")
];
...
...
GetStringAtLoc(rgStrings, dwValue, rgBytes, &szReplacement);
CStringW strW(szReplacement ? szReplacement : rgBytes.m_aT); // 在该行报错
...

已经查了很久,没有解决办法,请问有朋友遇到过类似的情况没有,最后如何解决的?

======================

问题暂时解决,办法如下:

1、在atlplus.h中,用<stdstring.h>代替<atlstr.h>:
(stdstring.h是Joe O'Leary编写的用于取代完整取代CString的类,基于std::string)

#include <stdstring.h>

2、修改报错行:
CStringW strW(szReplacement ? szReplacement : rgBytes.m_aT); // 在该行报错

修改为:
CStdStringW strW(szReplacement ? szReplacement : rgBytes.m_aT); // 该行通过

现在编译已通过,但由于我改变了系统文件<atlplus.h>的内容,给atl额外引入了stl的负担,会影响atl完整性和高效性。该解决办法是很不恰当的。

还请各位高人给出合适的解决办法,谢谢。

posted on 2006-08-01 21:12 龙井2008 阅读(1594) 评论(0)  编辑 收藏 引用 所属分类: 代码片段

只有注册用户登录后才能发表评论。