简体   繁体   English

为什么在线 C++ IDE 不支持“graphics.h”头文件?

[英]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我尝试使用TechGeekBuzz: Best C++ Online Compiler 中的列表使用“graphics.h”头文件使用 C++ 的多个 IDE 编译代码,但他们标记了错误

1:21: fatal error: graphics.h: No such file or directory 1:21:致命错误:graphics.h:没有那个文件或目录

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.一些(但不是全部)还提供 posix 头文件或非常流行的库,例如 boost。

Neither <graphics.h> nor <conio.h> are standard headers. <graphics.h><conio.h>都不是标准标题。 Both are old MSDOS legacy that you will not find on any online compiler:两者都是您在任何在线编译器上都找不到的旧 MSDOS 遗产:

  • conio.h offers non-standard and non-portable console functions, like for example the famous kbhit() . conio.h提供非标准和不可移植的控制台功能,例如著名的kbhit()
  • graphics.h is a vendor specific header for a library that is no longer supported since 1997. graphics.h是自 1997 年以来不再受支持的库的供应商特定头文件。

In addition, online compilers provide a command line interface.此外,在线编译器提供命令行界面。 They are not suitable for graphic development.它们不适合图形开发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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