C程序编译错误

Jam*_*est 3 c visual-studio-2010

我是编程新手,并将C语言作为我的第一个计算机语言.我正在做一个示例转换程序,当我编译代码时,我得到以下错误.

它是什么意思,我该如何解决它?

谢谢!

1>------ Build started: Project: ConversionProgram, Configuration: Debug Win32 ------
1>Build started 24-07-2012 20:58:37.

1>InitializeBuildStatus:

1> Touching "Debug\ExcerciseProgram1.unsuccessfulbuild".
1>ClCompile:
1> conversion.cpp
1>c:\my documents\visual studio 2010\projects\excerciseprogram1\excerciseprogram1\question2.cpp(12): warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 10.0\vc\include\stdio.h(304) : see declaration of 'scanf'
1>c:\my documents\visual studio 2010\projects\excerciseprogram1\excerciseprogram1\question2.cpp(18): warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
1>c:\my documents\visual studio 2010\projects\excerciseprogram1\excerciseprogram1\question2.cpp(32): error C2857: '#include' statement specified with the /YcStdAfx.h command-line option was not found in the source file
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.1
Run Code Online (Sandbox Code Playgroud)

我使用VB 2010作为我的IDE

Pla*_*gue 8

这里提到了您遇到编译错误的原因:

错误C2857:在源代码中找不到使用/YcStdAfx.h命令行选项指定的'#include'语句

这意味着编译器正在包含StdAfx.h强制性.您可以通过添加#include <StdAfx.h>源代码来解决此问题.


Som*_*ude 6

您的源文件似乎不包括预编译的头文件."stdafx.h"如果您使用的是预编译标头,则所有源文件必须包括第一个非注释.