|
发表于 2005-8-27 15:59:45
|
显示全部楼层
Post by mantou
#include <stdio.h>
3
4 void lgc(void);
5 char answer;
6
7 int main()
8 {
9 char a;
10 clrscr();
11 gotoxy(12,3);
12 puts("Welcomto to Linux");
13 gotoxy(15,13);
14 printf("<CR>--Continue");
15
16 while(1)
17 {
18 a=getch();
19 if(a==27)
20 break;
21 if(a==13)
22 {
23 lgc();
24 if(answer=='y' || answer=='Y')
25 {
26 gotoxy(23,14);
27 puts(" lease write to the Linux");
28 getch();
29 break;
30 }
31 }
32 }
33 return(0);
34 }
35
36 void lgc(void)
37 {
38 clrscr();
39 gotoxy(12,8);
40 printf("The Excellent Selection!");
41 gotoxy(21,12);
42 printf("Do you have any question?(Y/N)");
43 answer=getch();
44 }
gcc -o 1 1.c
/tmp/ccTmsCEl.o: In function `main':
1.c .text+0x1d): undefined reference to `clrscr'
1.c .text+0x29): undefined reference to `gotoxy'
1.c .text+0x48): undefined reference to `gotoxy'
1.c .text+0x62): undefined reference to `getch'
1.c .text+0x94): undefined reference to `gotoxy'
1.c .text+0xac): undefined reference to `getch'
/tmp/ccTmsCEl.o: In function `lgc':
1.c .text+0xbe): undefined reference to `clrscr'
1.c .text+0xca): undefined reference to `gotoxy'
1.c .text+0xe9): undefined reference to `gotoxy'
1.c .text+0x101): undefined reference to `getch'
collect2: ld returned 1 exit status
怎么提示的错误,没有显示行号?? 怎么是十六进制的?/ clrscr,gotoxy 需要那些头文件,现在有点忘了
#include <system.h> 也找不到这个头文件,我要把常用的头文件都装好,要怎么装呀??
Functions like 'gotoxy' and 'clrscr', etc. are provided in TC by Borland, which are not stantard functions. I had found them in Dev C++ for Windows, which is a IDE based on GCC and some extended libs supplied by Dev C++ itself for some programers take TC as the only C language version in the world. In Linux, NO such functions available in any libs known by me by now.
Programming in Windows and in Linux is not quite the same. The C language in both OS has no different while the libs and interfaces offered by OS are far from the same. So, taking some time to learn the system itself is a useful and worthwhile step, I think. |
|