BGI错误,如何解决?

发布于 2024-12-07 11:20:30 字数 339 浏览 0 评论 0原文

我想运行一个画圆的C 程序。该程序正在编译,没有错误并且正在运行。从用户那里获取半径等值后,我收到如下错误:

BGI error: Graphics notinitialed ( use "initgraph")

即使在我的源代码中我添加了这一行:

int gmode,gdrive=DETECT;
initgraph(&gdrive,&gmode,"c\\tc\\bgi");

仍然我出现错误。

我使用的是Windows,但我不知道我哪里出了问题。有人可以在这方面帮助我吗?

提前致谢。

I want to run a C program that draws a circle. The program is compiling with no error and it is running. After getting the values like radius from the user, I get the error like this :

BGI error: Graphics not initialized ( use "initgraph")

Even though in my source code I have added this line :

int gmode,gdrive=DETECT;
initgraph(&gdrive,&gmode,"c\\tc\\bgi");

Still I'm getting error.

I'm using Windows and I couldn't figure out where I went wrong. Can anyone help me in this regard?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

樱娆 2024-12-14 11:20:30

您在 initgraph 中的路径是错误的。请改用 "c:\\tc\bgi"

Your path in initgraph is wrong. Use "c:\\tc\bgi" instead.

走过海棠暮 2024-12-14 11:20:30

如果您在运行图形程序时收到此错误消息: BGI Error: Graphics notinitialed (use 'initgraph')

只需将 \tc\bgi\EGAVGA.BGI 文件复制到本地运行应用程序的文件夹。

If you get this error message when you run your graphics program: BGI Error: Graphics not initialized (use 'initgraph')

Just you need to copy the \tc\bgi\EGAVGA.BGI file to your local folder where you are running the application.

岁月打碎记忆 2024-12-14 11:20:30

尝试这个(它对我有用):

BGI 文件夹通常位于以下路径中,

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

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

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

Try this (it worked for me) :

The BGI folder is usually in the following path,

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

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

initgraph(&gd, &gm, "C:\\TurboC3\\BGI");
感受沵的脚步 2024-12-14 11:20:30

我也深受这个问题的困扰。

简而言之:

initgraph(&gdrive,&gmode, "c:\tc\bgi"); 

这里c:\tc\bgi很重要。

最重要:

tc.exe(您正在使用的)中,顶部有一些菜单,例如文件、编辑、选项:

  • 转到选项>应用程序
  • 选择覆盖(默认情况下是“标准”,但必须选择“覆盖”选项),然后单击“确定”。
  • 现在运行图形程序。

注意:在输出中,如果它给出有关bgi的错误,请忽略它,只需在需要时提供程序的输入,它就会为您提供图形输出。享受。

I also suffered from that problem.

Simply put this line:

initgraph(&gdrive,&gmode, "c:\tc\bgi"); 

here c:\tc\bgi is important.

MOST IMPORTANT:

In tc.exe (which you are using) at top are some menus like file, edit, options:

  • Go options>application
  • select overlay (By Default it is "standard" but you must select "overlay" option), then click on ok.
  • now you run your graphics progaram.

NOTE: in the output, if it gives an error about bgi, ignore it, just give the input for the program if it is required and it will give you the graphics output. Enjoy.

最笨的告白 2024-12-14 11:20:30

可能有多种原因:

  • bgi 文件路径错误(我看到冒号丢失了)
  • 不支持的图形模式(不要指望 DOS 图形应用程序可以在 Vista 及更高版本下工作)

Could be multiple reasons:

  • wrong path to the bgi file (I see the colon is missing)
  • unsupported graphics mode (don't expect DOS graphics apps to work under Vista and up)
时光倒影 2024-12-14 11:20:30

如果通过包含“C:\tc\bgi”仍然存在错误,请尝试以下操作:
转到文件->更改目录..
将其更改为 bgi..但这必须在每次打开 Turboc 时完成

if by including "C:\tc\bgi" still the error persists , try this:
goto file-> change directory..
change it to bgi.. but this has to be done every time u open the turboc

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文