我正在用C开发我的项目。在Windows-7上我使用DosBox来实现我的代码。在编译时,我的项目没有显示任何错误。但是当我运行我的项目时,只需在输出屏幕上显示以下行。
bgi error graphics not initialized use initgraph
这是我的代码:
void firstscreen()
{
int gm=DETECT;
initgraph(&gm,&gm,"");
floodfill(300,230,RED);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,5);
setcolor(BLUE);
sound(1345);
outtextxy(100,40,"S.A.JAIN COLLEGE ");
outtextxy(190,90,"AMBALA CITY");
settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
setcolor(GREEN);
outtextxy(210,230,"PROJECT REPORT ");
outtextxy(290,265,"ON ");
outtextxy(240,300,"MOBILE SHOP");
settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
setcolor(CYAN);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
outtextxy(160,400,"Developed By - MAHI");
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,1);
outtextxy(240,440,"Press any key to enter in the program........");
nosound();
getch();
closegraph();
}
void showroom()
{
int gm=DETECT;
initgraph(&gm,&gm,"");
floodfill(300,230,RED);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
setcolor(BLACK);
sound(1345);
outtextxy(240,25,"SHOWROOM");
outtextxy(240,50,"^^^^^^^^^");
settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
setcolor(RED);
outtextxy(10,85,"Model No Price(Rs\-) Color Wranty");
settextstyle(TRIPLEX_FONT,HORIZ_DIR,2);
setcolor(GREEN);
outtextxy(10,125, "X2-01 2300 WHITE 1 YEAR");
outtextxy(10,155,"X3-02 7800 BLACK 1 YEAR ");
outtextxy(10,185,"E5 4800 BLACK 1 YEAR");
outtextxy(10,215,"3110 3800 BLACK 1 YEAR ");
outtextxy(10,245,"7210 5200 BLACK 1 YEAR");
outtextxy(10,275,"5233 5800 BLACK 1 YEAR ");
outtextxy(10,305,"N70 8000 BLACK 1 YEAR");
outtextxy(10,335,"N72 8800 BLACK 1 YEAR");
outtextxy(10,365,"N95 10500 BLACK 1 YEAR");
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,1);
outtextxy(440,440,"Press enter......");
nosound();
getch();
closegraph();
}
所以我在这看到了类似的问题,但主人没有接受答案。而且当我尝试那些解决方案仍然是同样的问题。大多数答案建议使用BGI库的路径。我计算机中BGI库的路径。
C:\\TurboC++\\Disk\\TurboC3\\BGI
在我的代码中,我设置的路径如下 -
int gm = DETECT;
initgraph(&gm,&gm,"C:\\TurboC++\\Disk\\TurboC3\\BGI");
但是仍然没有同样的问题。请帮我解决这个问题。提前谢谢。
答案 0 :(得分:1)
最近我有类似的问题。要从EGAVGA.BGI
解决此副本BGI folder
并粘贴到BIN folder
。
希望它有效。