关于VC++的编译错误问题
来源:百度知道 编辑:UC知道 时间:2024/04/29 23:33:36
// Project2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int main(int argc, char* argv[])
{
printf("Hello World!\n");
return 0;
}
出现错误:fatal error C1010: unexpected end of file while looking for precompiled header directive
如果这个程序由VC++自己就没问题,但如果自己编写,而且跟跟VC++生成的程序一模一样,就有上面的错误,为什么??讲得详细易懂一点,我还是新手!
["stdafx.h"是VC++自动生成的,里面已经包了<stdio.h>。建议打开
VC++生成的程序看看"stdafx.h"的内容。针对以上程序可以直接将#include "stdafx.h" 换为#include "stdio.h" ]
不行啊,可不可以讲得具体一点!
对“第二条回答”:都说我是新手,可不可以具体一点?不明白!
还是不明白!!!
你没编译stdafx.cpp文件就会有这样的错误。
stdafx.h是vc生成的预编译头文件,在编译所有文件之前,必须先编译stdafx.cpp(也是vc生成的)。否则编译就会出错。
"stdafx.h"是VC++自动生成的,里面已经包了<stdio.h>。建议打开
VC++生成的程序看看"stdafx.h"的内容。
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__1520502C_999A_4BF0_A280_41A89D95C99D__INCLUDED_)
#define AFX_STDAFX_H__1520502C_999A_4BF0_A280_41A89D95C99D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <stdio.h>
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#e