簡體   English   中英

C程序編譯錯誤

[英]C program compilation error

我是編程新手,並將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

這里提到了您遇到編譯錯誤的原因:

錯誤C2857:在源代碼中找不到使用/YcStdAfx.h命令行選項指定的'#include'語句

這意味着編譯器必須強制包含StdAfx.h 您可以通過在源代碼中添加#include <StdAfx.h>來解決此問題。

您的源文件似乎不包括預編譯的頭文件。 如果您使用預編譯頭,則所有源文件必須包含"stdafx.h"作為第一個非注釋。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM