尝试使旧代码正常工作时在 CString 上使用 typedef 时出错
我有一些用于控制 wifi 模块的示例代码,它告诉我使用 VC 6.0,并且不支持较新的版本。无论如何,我正在努力让它发挥作用。它使用 CString,它是 MFC 的一部分,因此我下载了 Visual Studio 2010 的试用版,看看是否可以编译它。 这是引发错误(开始)的代码:
#ifdef _UNICODE
//Use CString as the standard string type in UNICODE versions
typedef CString WuString; // Line 42
#endif
这是错误消息:
1>d:\...\my documents\authapiex\apps8.0.0.90_sdk_xp\include\wtypes.h(42): error C2146: syntax error : missing ';' before identifier 'WuString'
1>d:\...\my documents\authapiex\apps8.0.0.90_sdk_xp\include\wtypes.h(42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\...\my documents\authapiex\apps8.0.0.90_sdk_xp\include\wtypes.h(42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
任何帮助都会很棒。
I've got some example code for controlling a wifi module that tells me to use VC 6.0, and that newer versions aren't supported. I'm trying to get it work, anyway. It uses CString, which is part of MFC, so I've downloaded a trial of Visual Studio 2010 to see if I can get it to compile.
Here's the code that's throwing the (start of the) errors:
#ifdef _UNICODE
//Use CString as the standard string type in UNICODE versions
typedef CString WuString; // Line 42
#endif
And here's the error messages:
1>d:\...\my documents\authapiex\apps8.0.0.90_sdk_xp\include\wtypes.h(42): error C2146: syntax error : missing ';' before identifier 'WuString'
1>d:\...\my documents\authapiex\apps8.0.0.90_sdk_xp\include\wtypes.h(42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\...\my documents\authapiex\apps8.0.0.90_sdk_xp\include\wtypes.h(42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Any help would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您缺少 CString 的包含。
You are missing the include for CString.
看起来 CString 没有在您放入 typedef 的地方定义。您需要确保在 typedef 之前包含适当的包含文件。
It looks like CString is not defined at the point where you put in the typedef. You'll need to make sure to include the appropriate include file before your typedef.