BGI error, how to solve it?

I want to run a C program that draws a circle. The program compiles without errors and works. Having received the radius values ​​from the user, I get this error:

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

Although in my source code I added this line:

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

However, I get an error.

I am using Windows and I could not figure out where I was wrong. Can anyone help me in this regard?

Thanks in advance.

+3
source share
6 answers

Your initgraph path is incorrect. Instead, use "c:\\tc\bgi" .

+5
source

I also suffered from this problem.

Simply put:

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

here c:\tc\bgi .

THE MOST IMPORTANT:

In tc.exe (which you use) at the top are some menus, such as file, edit, options:

  • Go options> application
  • select overlay (the default is "standard", but you must select the "overlay" option), then click "ok".
  • You are now starting your graphics program.

NOTE: in the output, if it gives a bgi error message, ignore it, just specify the input for the program, if necessary, and this will give you a graphical output. Enjoy it.

+1
source

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

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

+1
source

Try it (it worked for me):

The BGI folder is usually located in the following path:

C: \ TurboC ++ \ drive \ TurboC3 \ BGI

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

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

There may be several reasons:

  • wrong path to bgi file (I see that the colon is missing)
  • unsupported graphics mode (do not expect DOS graphics applications to run on Vista or higher)
0
source

if, adding "C: \ tc \ bgi", the error persists, try the following: goto file-> change directory .. change it to bgi .. but you need to do this every time you open turboc

0
source

All Articles