C++ ‘;graphresult’;未在此范围中声明

C++ ‘;graphresult’;未在此范围中声明,c++,c,graphics,C++,C,Graphics,我正试图在我的ubuntu18.04 LTS系统上运行graphics程序,以打印图形操作失败的错误代码。我的代码是 #include <graphics.h> #include <stdlib.h> int main() { int gd, gm, errorcode; initgraph(&gd, &gm, NULL); errorcode = graphresult();

我正试图在我的
ubuntu18.04 LTS
系统上运行
graphics
程序,以打印图形操作失败的
错误代码。我的代码是

    #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;
    }


我在互联网上到处搜索,但没有找到一个有希望的解决方案。谁能帮帮我吗。提前感谢:)

图形。h
已经过时得可怕,您应该用更现代化的库(例如SDL2)来替换它。您确定包含的
头文件包含
graphresult
函数吗?自DOS时代以来,这些工具从未被标准化或广泛使用(除了那些完全不懂其他知识的初学者之外),那么,你发现的实现可能没有实现BGI的所有功能?是C还是C++?实际上,图形是在我的学校大纲中,所以我必须学习它。但是你能告诉我一些选择<代码>图形结果()/<代码>函数吗?这将是一场伟大的比赛help@RudreshDixit如果你必须使用它,最简单的选择是在Dox框中运行Turbo C++。
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));