为什么我电脑上的不能运行?有什么错误么?

#include <stdio.h>
#include <graphics.h>
main()

int graphdriver=VGA; 
int graphmode=VGAMED;
int i,height,width;
unsigned char *temp="Welcome";
initgraph(&graphdriver,&graphmode,"");
settextjustify(LEFT_TEXT,TOP_TEXT);
cleardevice();
for(i=1;i<11;i++)
{
setvisualpage(0);
setactivepage(1);
cleardevice();
setcolor(12);
setbkcolor(BLUE);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,i);
width=textwidth(temp);
height=textheight(temp);
outtextxy((639-width)/2,175-height/2,temp);
setvisualpage(1);
setactivepage(0);
cleardevice();
setcolor(10);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,i++);
width=textwidth(temp);
height=textheight(temp);
outtextxy((639-width)/2,175-height/2,temp);
}
getch();
closegraph();
}
我安的就是TC BGI error: graphics not initialiaed<use'initraph'>

ABOUTYOU
浏览 121回答 2
2回答

交互式爱情

int graphdriver=DETECT; 试验一下。确保:Options → linker → graphics library打上on!

MMTTMM

建立一个不需要驱动程序就能独立运行的可执行图形程序,Turbo C中规定用下述步骤(这里以EGA、VGA显示器为例):&nbsp;1. 在C:\TC子目录下输入命令:&nbsp;BGIOBJ EGAVGA&nbsp;此命令将驱动程序EGAVGA.BGI转换成EGAVGA.OBJ的目标文件。&nbsp;2. 在C:\TC子目录下输入命令:&nbsp;TLIB LIB\GRAPHICS.LIB+EGAVGA&nbsp;此命令的意思是将EGAVGA.OBJ的目标模块装到GRAPHICS.LIB库文件中。&nbsp;3. 在程序中initgraph()函数调用之前加上一句:&nbsp;registerbgidriver(EGAVGA_driver):&nbsp;该函数告诉连接程序在连接时把EGAVGA的驱动程序装入到用户的执行程序中。&nbsp;经过上面处理,编译链接后的执行程序可在任何目录或其它兼容机上运行。&nbsp;例:&nbsp;#include<stdio.h>&nbsp;#include<graphics.h>&nbsp;int main()&nbsp;{&nbsp;int gdriver=DETECT,gmode;&nbsp;registerbgidriver(EGAVGA_driver): / *建立独立图形运行程序 */&nbsp;initgraph( gdriver, gmode,"c:\\tc");&nbsp;bar3d(50,50,250,150,20,1);&nbsp;getch();&nbsp;closegraph();&nbsp;return 0;&nbsp;}&nbsp;编译链接后产生的执行程序可独立运行。&nbsp;如不初始化成EGA或CGA分辨率, 而想初始化为CGA分辨率, 则只需要将上述步骤中有EGAVGA的地方用CGA代替即可。
打开App,查看更多内容
随时随地看视频慕课网APP