Why don't online C++ IDEs support “graphics.h” header file?

懵懂的女人 提交于 2020-12-06 12:57:05

问题


I tried compiling code using several IDEs of C++ using "graphics.h" header file using the list in TechGeekBuzz: Best C++ Online Compiler but they flag the error

1:21: fatal error: graphics.h: No such file or directory

The program I am trying to run is

#include<graphics.h>
#include <conio.h>
int main()
{
    int gd = DETECT, gm;
    initgraph(&gd,&gm, "C:\\tc\\bgi");
    circle(300,300,50);
    closegraph();
    getch();
}

回答1:


You should only expect the standard headers to be available in online compilers. Some (but not all) also provide posix headers or very popular libraries such as boost.

Neither <graphics.h> nor <conio.h> are standard headers. Both are old MSDOS legacy that you will not find on any online compiler:

  • conio.h offers non-standard and non-portable console functions, like for example the famous kbhit().
  • graphics.h is a vendor specific header for a library that is no longer supported since 1997.

In addition, online compilers provide a command line interface. They are not suitable for graphic development.



来源:https://stackoverflow.com/questions/59704241/why-dont-online-c-ides-support-graphics-h-header-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!