首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

'grOK' : undeclared identifier 求解解决方法

2012-09-11 
grOK : undeclared identifier 求解#includegraphics.h#includestdlib.h#includestdio.h#include

'grOK' : undeclared identifier 求解
#include<graphics.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
 
int main(void)
{
  //select a driver and mode that supports
  //multiple drawing colors
  int gdriver=EGA,gmode=EGAHI, errorcode;
  int color, maxcolor, x, y;
  char msg[80];
   
  //initialize graphics and local variables
  initgraph(&gdriver, &gmode," ");
  
  //read resule of initiazation
  errorcode=graphresult();
  if (errorcode!= grOK)
  {
  printf("Graphics error:%s\n", grapherrormsg(errorcode));
  printf("Press and key to halt:");
  getch();
  exit(1);
  //terminate with an error code
  }
  //maxinum color index supported
  maxcolor=getmaxcolor();

  //for centering text message
  settextjustify(CENTER_TEXT,CENTER_TEXT);
  x=getmaxx()/2;
  y=getmaxy()/2;
   
  //loop through the available colors
  for (color=1; color<=maxcolor; color++)
  {
  //clear the screen
  cleardevice();
   
  //select a new background color
  setcolor(color);
 
  //output a message
  sprintf(msg,"Color:%d",color);
  outtextxy(x,y,msg);
  getch();
  }
  //clean up
  closegraph();
  return 0;
}
编译是为什么显示'grOK' : undeclared identifier

[解决办法]
这个TC下的代码啊。。。
[解决办法]
#include<graphics.h>
搜索一下这个文件里有没有定义grOk,没有的话更新一下这个文件吧。
[解决办法]
VC就建一个MFC对话框程序,然后在OnPaint里面修改绘制内容。
CPaintDC dc; dc.MoveTo(0,0); dc.LineTo(100,100);
[解决办法]
http://www.easyx.cn
[解决办法]

探讨
#include<graphics.h>
搜索一下这个文件里有没有定义grOk,没有的话更新一下这个文件吧。

热点排行