简体   繁体   English

C程序编译错误

[英]C program compilation error

I am new to programming and picked up the C language as my first computer language. 我是编程新手,并将C语言作为我的第一个计算机语言。 I was doing a sample conversion program and when i compiled the code, i get the following error. 我正在做一个示例转换程序,当我编译代码时,我得到以下错误。

What does it mean and how do i fix it? 它是什么意思,我该如何解决它?

Thanks! 谢谢!

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

I am using VB 2010 as my IDE 我使用VB 2010作为我的IDE

The reason why you are experiencing a compile error is mentioned here: 这里提到了您遇到编译错误的原因:

error C2857: '#include' statement specified with the /YcStdAfx.h command-line option was not found in the source 错误C2857:在源代码中找不到使用/YcStdAfx.h命令行选项指定的'#include'语句

This means that the compiler is making the inclusion of StdAfx.h compulsory. 这意味着编译器必须强制包含StdAfx.h You can remedy this by adding #include <StdAfx.h> to your source code. 您可以通过在源代码中添加#include <StdAfx.h>来解决此问题。

It seems that your source file is not including the precompiled header file. 您的源文件似乎不包括预编译的头文件。 All source files must, as first non-comment, include "stdafx.h" if you are using precompiled headers. 如果您使用预编译头,则所有源文件必须包含"stdafx.h"作为第一个非注释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM