C语言 BGI 错误:图形未初始化(使用 initgraph)...在 DOSBOX...Win 7

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17683517/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 06:54:55  来源:igfitidea点击:

BGI Error:Graphics not initialised(use initgraph)...in DOSBOX...Win 7

cgraphicsdosbox

提问by user1943533

I gave the location of bgi folder in my C drive as below:

我在 C 盘中给出了 bgi 文件夹的位置,如下所示:

initgraph(&gd,&gm,"C:\TurboC++\Disk\TurboC3\BGI");

The program compiles without any error but while running nothing appears...

程序编译没有任何错误,但在运行时什么也没有出现......

When I press Alt+F5 I found this error. How to resolve this?

当我按 Alt+F5 时,我发现了这个错误。如何解决这个问题?

回答by Theja

I hope this helps:

我希望这有帮助:

Now, as we know the BGI folder is usually in the following path,

现在,我们知道 BGI 文件夹通常在以下路径中,

C:\TurboC++\disk\TurboC3\BGI

C:\TurboC++\磁盘\TurboC3\BGI

BGI is inside the folder "TurboC3" and NOT "TC".

BGI 位于文件夹“TurboC3”而不是“TC”中。

So the code you need to put in your program is as follows,

所以你需要在你的程序中放入的代码如下,

initgraph(&gd, &gm, "C:\TurboC3\BGI");

回答by Khan Sumaiyya

After declaring variable.

声明变量后。

You have to write the following code in your program.

您必须在程序中编写以下代码。

initgraph(&gd , &gm ,"C:\TurboC++\BGI");