【问题标题】:C++ error typedef cannot be overloadedC++ 错误 typedef 不能被重载
【发布时间】:2012-12-26 21:28:27
【问题描述】:

我有这个 c++ 程序,但由于某种原因它无法编译。我正在将 XP 与 VS 2005 一起使用。

#include "stdafx.h"
#include "MainThread.h"

HANDLE  hStopEvent = NULL;

int main(int argc, char *argv[])
{

    return 0;
}

error C2146: syntax error : missing ';' before identifier 'hStopEvent'
error C2377: 'HANDLE' : redefinition; typedef cannot be overloaded with any other symbol
see declaration of 'HANDLE'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

【问题讨论】:

  • 问题出在你的标题中。

标签: c++ visual-studio-2005 windows-xp


【解决方案1】:

该错误很可能是因为头文件中存在问题,导致编译器将它在源文件中找到的第一件事视为标识符。

类似于未完成的结构或类定义:

struct blah {
    int a;
} // MISSING ';'

如果看不到,建议贴出头文件。

【讨论】:

  • 是的,你是对的......这是重新定义的东西,但你可以在没有明确重新定义的情况下得到它......
【解决方案2】:

你好像忘记了

#include <Windows.h>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-23
    • 1970-01-01
    • 2012-11-20
    • 1970-01-01
    • 2010-10-10
    • 2016-08-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多