尝试使旧代码正常工作时在 CString 上使用 typedef 时出错

发布于 2024-09-07 06:04:27 字数 841 浏览 4 评论 0原文

我有一些用于控制 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

猛虎独行 2024-09-14 06:04:27

您缺少 CString 的包含。

#include <afx.h>

You are missing the include for CString.

#include <afx.h>
放肆 2024-09-14 06:04:27

看起来 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文