【发布时间】:2014-11-04 17:25:13
【问题描述】:
对于大学,我需要使用提供的模板创建一个基本的桌面计算器。我已经设法完成了大部分工作,但第 9 行有此错误消息 (iScreenSetup();:
" [警告] 数据定义没有类型或存储类[默认启用]"
有什么建议吗?
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
#include "string.h"
/* Prototypes */
iScreenSetup();
iDataCapture();
iProcessData();
iReport();
iExit();
/* Declare and initialise global variables */
float fNum1 = 0.0;
float fNum2 = 0.0;
float fAns = 0.0;
int iOption = 0;
int main(void)
{
/* Set up the screen */
iScreenSetup();
/* Prompt the user and capture the data */
iDataCapture();
/* Process the data */
iProcessData();
/* Generate the report */
iReport();
/* Exit routine */
iExit();
} /* End of main */
【问题讨论】:
-
您没有在函数声明中指定返回类型。默认情况下,它将采用
int。例如。iScreenSetup();应该是<datatype> iScreenSetup();例如int iScreenSetup();。 -
这与implicit int有关,在C89中如果你不指定类型则默认为
int,尽管在C99之后这已经消失了many compiler still support it。 -
当你的函数名从
i开始时,它应该返回int。例如。int iScreenSetup(); -
我遇到错误“未定义对 textcolor 的引用”有什么提示吗?
-
一些 C 带有“conio.h”,这不是标准的,其中大多数包含 textcolor() 函数,但可能不是全部。如果这是一个问题,请发布一个新问题并显示实际使用 textcolor 的代码。
标签: c class storage definition