简体   繁体   中英

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

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();
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM