C ++错误typedef无法重载

时间:2012-12-26 21:28:28

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

我有这个c ++程序,由于某种原因它不会编译。我在VS 2005中使用XP。

#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

2 个答案:

答案 0 :(得分:4)

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

有一个未完成的结构或类定义:

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

如果您看不到,我建议发帖头文件。

答案 1 :(得分:2)

好像你忘记了

#include <Windows.h>
相关问题