Visual C++ 中的编译错误
我正在使用 Visual Studio 2010 来构建 C 项目。我的项目包含许多头文件、源文件和解析器。它使用 lex
和 bason
文件。我在编译过程中遇到一个错误,然后
abc.y:error C2065: 'INPUT' : undeclared identifier
我尝试了以下解决方案,例如
#define WIN32_WINNT >= 0x0501
在包含任何头文件之前将其包含在我的 main.c 文件中。我无法消除此错误。您能否告诉我此错误的原因是什么?
编辑
显示错误的代码片段是:
list_Cons(0, list_List((POINTER)INPUT)
令人惊讶的是,如果我将 INPUT 更改为 INPUT1,我会得到相同的错误。改变是坚忍的。
I am using Visual studio 2010 for building C project. My project contains a number of header files,source file and parsers. It uses lex
and bason
files. I am getting a single error during the compilation and íé the following
abc.y:error C2065: 'INPUT' : undeclared identifier
I tried the solutions I am getting like including
#define WIN32_WINNT >= 0x0501
in my main.c file before the inclusion of any of the header files.I am not able to get rid of this error. Could you please let me know what Can be the reasons for this error?
EDIT
The snippet of code that is showing error is:
list_Cons(0, list_List((POINTER)INPUT)
The surprising thing is that If i alter INPUT into INPUT1, I get the same error. It is stoic to change.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
想必您阅读了此和此。
#define WIN32_WINNT >= 0x0501
不起作用。您应该尝试改用#define WIN32_WINNT 0x0501
。另外,检查您是否确实#include winuser.h
Presumably you read this and this.
#define WIN32_WINNT >= 0x0501
wont work. You should try using#define WIN32_WINNT 0x0501
instead.Also, check that you are actually #including winuser.h
C++ 编译器无法处理 *.y 文件。为此,您需要一个 yacc / bison 程序,该程序未包含在 Visual Studio 2010 中。
A C++ compiler cannot process a *.y file. For that you need a yacc / bison program, which does not come included with Visual Studio 2010.
对于我自己,我使用 CMake 它可以生成 MSVC 项目以及其他构建类型。您可以告诉它 .y 需要处理 outwith C/C++ 文件,它将指示 MSVC 调用预处理非 C/C++ 部分所需的任何外部工具。
For myself I use CMake which can generate MSVC projects along with other build types. You can tell it that a .y needs to be processed outwith the C/C++ files and it will instruct MSVC to invoke whatever external tools are necessary to preprocess the non-C/C++ parts.