我是编程新手,选择 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
我正在使用 VB 2010 作为我的 IDE
最佳答案
这里提到了您遇到编译错误的原因:
error C2857: '#include' statement specified with the /YcStdAfx.h command-line option was not found in the source
这意味着编译器正在包含 StdAfx.h
强制性的。您可以通过添加 #include <StdAfx.h>
来解决这个问题到您的源代码。
关于C程序编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11645955/