Tuesday 14 April 2015

BGI Error graphics not initialized (Even if you have!)

Hi There !
I've had the same problem

Problem Description :
1.Program running in Turbo C 3.
2.Error found in output window : "BGI Error Graphics not initialized use initgraph"

Problem Solution
1.Check if <graphics.h> is included
2.Check if you have all your TC files, including BIN folder and BGI folder.
3.Check this :
 int gmode,gdrive=DETECT;
 initgraph(&gdrive,&gmode,"c:\\tc:\\bgi");
4.Still problem persists?
  Copy "EVABGA.BGI" from your TC's BGI folder to TC's BIN folder
5.Check Directories : In TC -> Options -> Directories :
 Go to TC->Options->Linker->Libraries and check if Graphics Library has an "X" mark.
Default directories are given in image :

(It should work by now)

Special case :
6.(Problem scenario is you are running Windows 7 with transparency ;) )
While running, TC closes giving "Ignore or Continue" warning.
and even if program is correct, it does not run.
For that, you have to install dosbox (Current version is 0.74, just google it!)
Download Dosbox from Sourceforge
Install it.
Follow the following instructions

I am considering you know a little of dos
Default drive is set to Z:
considering your TC directory is "C:\TC"

i.)Enter "mount d C:\TC" (without quotes)
ii.)It will say Drive D is mounted as local directory C:\TC
iii.)Enter "D:" (without quotes)
iv.)Now enter "cd bin" and "tc" without quotes.
TC should be opened by now
v.)Change the directories , as wherever "C:\TC" is present, erase it and Enter "D:\" (without quotes)
vi)Go to TC->Options->Linker->Libraries and check if Graphics Library has an "X" mark.
If no, Check it

Done

I guess it should work now. :)
I hope this helps. If it did, Don't Forget To Mention It In Comments!

No comments:

Post a Comment