未在此范围内声明“ graphresult”

我正在尝试在graphics系统上运行Ubuntu 18.04 LTS程序以打印error code,以防止图形操作失败。我的代码是

    #include <graphics.h>
    #include <stdlib.h>

    int main()
    {
       int gd,gm,errorcode;

       initgraph(&gd,&gm,NULL);

       errorcode = graphresult();

       if(errorcode != grOk)
       {
          printf("Graphics error: %s\n",grapherrormsg(errorcode));
          printf("Press any key to exit.");
          getch();
          exit(1);
       }

       getch();
       closegraph();
       return 0;
    }

但是当我运行它时,出现以下错误:

g++ -o mygraphics mygraphics.c -lgraph
mygraphics.c: In function ‘int main()’:
mygraphics.c:10:20: error: ‘graphresult’ was not declared in this scope
        errorcode = graphresult();
                    ^~~~~~~~~~~
mygraphics.c:12:24: error: ‘grOk’ was not declared in this scope
        if(errorcode != grOk)
                        ^~~~
mygraphics.c:12:24: note: suggested alternative: ‘brk’
        if(errorcode != grOk)
                        ^~~~
                        brk
mygraphics.c:14:42: error: ‘grapherrormsg’ was not declared in this scope
           printf("Graphics error: %s\n",grapherrormsg(errorcode));

我在互联网上进行了搜索,但找不到有希望的解决方案。有人可以帮我吗。预先谢谢你:)

tomtomtom3 回答:未在此范围内声明“ graphresult”

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3129868.html

大家都在问