问题描述
我使用 TechGeekBuzz:最佳C ++在线编译器 但它们会标记错误
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
我要运行的程序是
#include<graphics.h>
#include <conio.h>
int main()
{
int gd = DETECT, gm;
initgraph(&gd,&gm, "C:\\tc\\bgi");
circle(300,300,50);
closegraph();
getch();
}
推荐答案
您应该只希望在线编译器中可以使用标准头文件.一些(但不是全部)还提供posix标头或非常流行的库(例如boost).
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.
<graphics.h>
和是标准标题.两者都是旧的MSDOS遗留物,在任何联机编译器上都找不到:
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
提供了非标准且不可移植的控制台功能,例如例如著名的kbhit()
. - graphics.h 是该库的特定于供应商的标头,自1997年以来不再受支持
conio.h
offers non-standard and non-portable console functions, like for example the famouskbhit()
.- 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.
这篇关于为什么在线C ++ IDE不支持"graphics.h"?头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!