问题
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