C程序编译错误

标签 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

我正在使用 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/

相关文章:

visual-studio-2010 - 在 VS 2010 中使用编码的 UI 测试启动 Web 应用程序

c# - 外部jar文件包含在monodroid的java绑定(bind)库中吗?

visual-studio-2010 - Hadoop-2.6.0 构建失败

c - 我应该如何将 char 指针数组的结构转换为 char 数组的数组?

c++ - GST_DEBUG : How to save logs in a separate file for a thread inside an application

c - 8051 μCU - 如何处理并发中断?

c - roll() 函数导致的未定义行为(使用 C)

c - 逐行替换txt中的字符串

visual-studio - Visual Studio 2010 几乎每次关闭时都会崩溃

visual-studio-2010 - 重新关联 Visual Studio 2012 的文件类型