| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1635 人关注过本帖
标题:[求助] gcc编译过程中对getch不支持,具体情况如下:
只看楼主 加入收藏
huzi00008
Rank: 1
等 级:新手上路
帖 子:112
专家分:0
注 册:2006-10-9
收藏
 问题点数:0 回复次数:1 
[求助] gcc编译过程中对getch不支持,具体情况如下:
#include "stdio.h"
mian()
{
int i=1,j;
char con_key='\x20';
float score[5],ratio[4]={0.1,0.2,0.2,0.5};
while (con_key=='\x20')
{
clrscr();
printf("输入第%2d秆?某杉?[m\n",i++);
printf("平时 学习 测验 期末成绩\n");
score[4]=0;
for(j=0;j<4;j++)
{
scanf("%f",&score[j]);
score[4]+=score[i]*ratio[j];
}
printf("总评成绩为:%6.1f\n",score[4]);
printf("\n按空格键继续,其它键退出");
con_key=getch();

}
编译信息:
/usr/lib/gcc-lib/i586-thiz-linux/3.3.1/../../../crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
/tmp/ccBeakGk.o(.text+0x3d): In function `mian':
: undefined reference to `clrscr'
/tmp/ccBeakGk.o(.text+0xe6): In function `mian':
: undefined reference to `getch'
collect2: ld returned 1 exit status

而后man getch 信息是(部分):

NAME
getch, wgetch, mvgetch, mvwgetch, ungetch, has_key - get (or push back)
characters from curses terminal keyboard

SYNOPSIS
#include <curses.h>

int getch(void);
int wgetch(WINDOW *win);
int mvgetch(int y, int x);
int mvwgetch(WINDOW *win, int y, int x);
int ungetch(int ch);
int has_key(int ch);


不知如何是好  


搜索更多相关主题的帖子: gcc getch 编译 
2006-10-27 10:18
maoguoqing
Rank: 6Rank: 6
来 自:重庆
等 级:贵宾
威 望:28
帖 子:2980
专家分:19
注 册:2005-12-5
收藏
得分:0 

不知道你用的什么编译器。。我加了#include <conio.h>
就可以编译通过了。。。。。。。。


天行健,君子以自强不息!!QQ:68660681
2006-10-27 18:15
快速回复:[求助] gcc编译过程中对getch不支持,具体情况如下:
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018994 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved