一、问题:
FILE结构在stdio.h中,可是如下代码已经包含了改头文件了!居然也报错了?
error C2065: 'FILE' : undeclared identifier
#include <stdio.h>
#include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
FILE *p;
return 0;
}
二、解决:
把stdio.h文件放在stdafx.h之后就好了!!!
#include "stdafx.h"
#include <stdio.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
FILE *p;
return 0;
}
本文介绍了一个关于C/C++编程中遇到的错误“'FILE':undeclared identifier”的问题及解决方案。该错误发生在包含stdio.h头文件后使用FILE类型变量时。通过调整stdio.h和其他头文件的包含顺序解决了此问题。
1万+

被折叠的 条评论
为什么被折叠?



