Visual C++错误 C2143:语法错误:缺少 ';'在“恒定”之前

发布于 2025-01-08 19:28:38 字数 730 浏览 1 评论 0原文

虽然该错误与其他人所经历的相同,但我的周围环境是完全不同。我实际上确实尝试声明一个常量:

const long CS_DROPSHADOW = 0x20000;
const long WS_EX_LAYERED = 0x80000;

报告两个常量名称的错误。

常量声明位于头文件中,位于任何类声明之外。

H 文件如下所示:

#ifndef _ASD_SMARTWINDOW_MAIN_H_TAGXXXMAIH_
#define _ASD_SMARTWINDOW_MAIN_H_TAGXXXMAIH_

#include "ASDTail.h" //Queue support.

namespace ASDSmartWindowMaster
{
...
};

class ASDSmartWindowListener
{
};

const long CS_DROPSHADOW = 0x20000;
const long WS_EX_LAYERED = 0x80000;

//Now comes a bunch of enums...
enum KLayeredWindowType
{ ... };


class ASDSmartWindow
{
};

#endif

While the error is identical to what others have experienced, my surroundings are completely different. I actually do try to declare a constant:

const long CS_DROPSHADOW = 0x20000;
const long WS_EX_LAYERED = 0x80000;

The error is reported for the two constant names.

The constants declaration is located in a Header file, outside any class declaration.

Here is how the H file looks like:

#ifndef _ASD_SMARTWINDOW_MAIN_H_TAGXXXMAIH_
#define _ASD_SMARTWINDOW_MAIN_H_TAGXXXMAIH_

#include "ASDTail.h" //Queue support.

namespace ASDSmartWindowMaster
{
...
};

class ASDSmartWindowListener
{
};

const long CS_DROPSHADOW = 0x20000;
const long WS_EX_LAYERED = 0x80000;

//Now comes a bunch of enums...
enum KLayeredWindowType
{ ... };


class ASDSmartWindow
{
};

#endif

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

清风不识月 2025-01-15 19:28:38

CS_DROPSHADOW 和 WS_EX_LAYERED 在 WinUser.h 中声明。
确认您没有将其包含在声明之前。

CS_DROPSHADOW and WS_EX_LAYERED are declared in WinUser.h.
Verify that you didn't include it before your declarations.

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