[請益] 由trubo c轉移到dev c++後產生的問題

看板Programming作者 (怎樣轉移檔案?)時間18年前 (2007/11/14 15:52), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
請教一下,下面的程式,是用Turbo C寫的 可是,當我轉移到Dev C++上面開發時,出現了 [Linker error] undefined reference to `delay' [Linker error] undefined reference to `randomize' [Linker error] undefined reference to `random' [Linker error] undefined reference to `gotoxy' [Linker error] undefined reference to `clrscr' 我想應該是編譯的參考檔 .h的差異造成的吧?! 現在想問幾個問題: 1.如何在dev c++內編譯這個c語言程式?或者要作哪些修改? 2.假如dev c++內不能編譯,請問windows環境內還有哪一套免費的c語言編譯軟體可以編譯呢? 附上原始程式如下,謝謝! #include <stdio.h> #include <ctype.h> #include <conio.h> #include <stdlib.h> #include <dos.h> int horse[8]; void mainmenu(void); int painthorse(int); void clrhorse(int); main() { int n,win,ch; //clrscr(); while(1) { while(1) { //clrscr(); printf("Please input the number of the horse which you want bet on.(0 to 7)"); scanf("%d",&n); if ((n>7)||(n<0)) { printf("Error number of the horses.\n"); delay(500); } else { printf("\nOK! you select no: %d's horse...\npress any key to start",n); getch(); break; } } int i; for (i=0;i<8;i++) horse[i]=1; mainmenu(); randomize(); i=0; while(1) { clrhorse(i); horse[i]+=random(3); win=painthorse(i); delay(15); if (win!=9) break; i=i+1; if (i==8) i=0; } gotoxy(1,20); printf("no: %d of the horse winning!!\n",win); if (win==n) printf("Waoo, you got it! You are so clever!\n"); else printf("Don't worry. You may get the champion at the next time!\n"); printf("Would you want to play the game again?(Y/N)"); ch=getch(); if (toupper(ch)=='N') break; } } void mainmenu(void) { int i,j; clrscr(); for (i=0;i<8;i++) { printf("\n"); for (j=0;j<70;j++) printf("="); printf("\n"); } } int painthorse(int i) { int win; gotoxy(horse[i],i*2+1); printf("%c",i+48); if (horse[i]>=70) win=i; else win=9; return win; } void clrhorse(int i) { gotoxy(horse[i],i*2+1); printf(" "); } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 40.19.39.91 ※ 編輯: quota 來自: 140.109.139.91 (11/14 15:52)

11/15 23:57, , 1F
文章代碼(AID): #17EgadG3 (Programming)
文章代碼(AID): #17EgadG3 (Programming)