| | |
BGI Error: Graphics error
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
I've tried out suggestions from several posts related to BGI Error (on daniweb n innumerable sites)but it just doesnt get solved.. Whenever i try to execute (after compiling successfully) a graphics program it either exits out of C and into DOS mode or it gives an error "The NTVDM comp encountered an illegal instruction #########(sum hexadecimal code) and i get options Close and Ignore(although after this i hav to restart TC)..
Let me give my computer specifications: 3.12GB RAM, Nvidia GeForce 7050/Nvidia nForce 610i 512 MB graphic card, win XP pro service pack 2, Intel Core2Duo Processor(2.20GHz) n a 19"W Acer LCD screen.. (tell me if u need ne more specifications).... Even a simple program lyk the 1 below is not working.....
Suggestions tried out by me
------------------------------------
1. I've already checked the [X] Graphics library option in Options->Linker->Libraries
2.I checked my BGI folder.. it has all the reqd BGI files such as EGAVGA.BGI, CGA.BGI n more
3.I've downloaded n tried atleast 5 TC's(v. 3.0) frm different sources.. none of em support graphics.. so there must be sumthin wrong wid my comp.. A program which works perfectly well in college doesnt work on my brand new home comp!!
4.I've even tried out running TC in compatibility mode for Win 98,95 but to no avail
I hope sum1 can tell me a permanent solution for this problem
P.S. All other types of programs work in my TC.. Only programs involving graphics do not work at all!!
Let me give my computer specifications: 3.12GB RAM, Nvidia GeForce 7050/Nvidia nForce 610i 512 MB graphic card, win XP pro service pack 2, Intel Core2Duo Processor(2.20GHz) n a 19"W Acer LCD screen.. (tell me if u need ne more specifications).... Even a simple program lyk the 1 below is not working.....
C Syntax (Toggle Plain Text)
#include <stdio.h> #include <conio.h> #include <graphics.h> void main() { int gd,gm; gd=DETECT; detectgraph(&gd,&gm); initgraph(&gd,&gm,"C:\\TC\\BGI"); line(100,100,200,100); getch(); closegraph(); }
Suggestions tried out by me
------------------------------------
1. I've already checked the [X] Graphics library option in Options->Linker->Libraries
2.I checked my BGI folder.. it has all the reqd BGI files such as EGAVGA.BGI, CGA.BGI n more
3.I've downloaded n tried atleast 5 TC's(v. 3.0) frm different sources.. none of em support graphics.. so there must be sumthin wrong wid my comp.. A program which works perfectly well in college doesnt work on my brand new home comp!!
4.I've even tried out running TC in compatibility mode for Win 98,95 but to no avail
I hope sum1 can tell me a permanent solution for this problem
P.S. All other types of programs work in my TC.. Only programs involving graphics do not work at all!!
Well I found this thing in your code:
Its normally this way:
When you are so sure about the libraries you possess then try out the example program given for <graphics.h> that should work fine for a try(As you are using TC).
If not follow this path:
start->control panel->system->advanced->Environmental Variables->System variables->find PATH->Click Edit->
After this DO NOT change anything else just include ; and then your TC path at the end.
Note: To find a solution to your problem you gave us all the details. Only your compiler configuration would be enough and the platform you are running it on.(Graphic details at max).Your other PC details wont be necessary.
c Syntax (Toggle Plain Text)
initgraph(&gd,&gm,"C:\\TC\\BGI");
c Syntax (Toggle Plain Text)
initgraph(&gd,&gm,"C:\TC\BGI");
When you are so sure about the libraries you possess then try out the example program given for <graphics.h> that should work fine for a try(As you are using TC).
If not follow this path:
start->control panel->system->advanced->Environmental Variables->System variables->find PATH->Click Edit->
After this DO NOT change anything else just include ; and then your TC path at the end.
Note: To find a solution to your problem you gave us all the details. Only your compiler configuration would be enough and the platform you are running it on.(Graphic details at max).Your other PC details wont be necessary.
I Surf in "C"....
> Let me give my computer specifications: 3.12GB RAM, Nvidia GeForce 7050/Nvidia nForce 610i 512 MB graphic card,
> win XP pro service pack 2, Intel Core2Duo Processor(2.20GHz)
Now let me give you the spec of your machine, which that fossil compiler deals with.
Then you decide whether you spend too much money on a Ferrari, only to rip the engine out and drive it round like a horse and cart.
> 3.12GB RAM
Nope, 640K (a stunning 0.02% of the total available).
Worse than that, it's all chopped up into not-so-handy 64K blocks with the out-moded segmented architecture.
> Nvidia GeForce 7050/Nvidia nForce 610i 512 MB graphic card
256K graphics card, no video acceleration, 256 colours max, 640x480 resolution max.
> win XP pro service pack 2
DOS (well, a bad emulation of DOS anyway).
> Intel Core2Duo Processor(2.20GHz)
Single core, using only 8086 instructions in 16-bit mode.
Here, have an abacus.
> win XP pro service pack 2, Intel Core2Duo Processor(2.20GHz)
Now let me give you the spec of your machine, which that fossil compiler deals with.
Then you decide whether you spend too much money on a Ferrari, only to rip the engine out and drive it round like a horse and cart.
> 3.12GB RAM
Nope, 640K (a stunning 0.02% of the total available).
Worse than that, it's all chopped up into not-so-handy 64K blocks with the out-moded segmented architecture.
> Nvidia GeForce 7050/Nvidia nForce 610i 512 MB graphic card
256K graphics card, no video acceleration, 256 colours max, 640x480 resolution max.
> win XP pro service pack 2
DOS (well, a bad emulation of DOS anyway).
> Intel Core2Duo Processor(2.20GHz)
Single core, using only 8086 instructions in 16-bit mode.
Here, have an abacus.
Yes.. i tried even that C:\TC\BGI n i STILL get the same problem.. here's the actual image of the problem that i'm facing.. when I press Ctrl+F9(for graphics programs), the screen goes blank for a sec n then i come back 2 windows with this pretty msg at the center of the screen!!

>The purpose behing me giving all the specifications of my comp was (not 2 blow my own trumpet) 2 clear a few misunderstandings.. one of our profs who teaches at Master's level told us that graphics doesn't work on 19" LCD monitors(can u believe that??!
>Csurfer, I've also tried out setting system variables as you said.. there were 2 system variables with names path (not PATH unless ur suggestion wasn't case-sensitive) and PATHEXT.. i tried indepepndently with each of them.. i wrote
>Moreover I saw another post on Daniweb in which the victim faced the same problem as i do now n he was advised 2 use a different compiler.. Now although this is a good suggestion.. i would appreciate it if sum1 culd actually take the pains 2 explain(and if possible solve that problem) me why even a simple graphics program doesn't work on my home comp but executes without any problem whatsoever on my college comp(i even copied that TC n pasted that in my comp only to end up with same problem!)
>The purpose behing me giving all the specifications of my comp was (not 2 blow my own trumpet) 2 clear a few misunderstandings.. one of our profs who teaches at Master's level told us that graphics doesn't work on 19" LCD monitors(can u believe that??!
>Csurfer, I've also tried out setting system variables as you said.. there were 2 system variables with names path (not PATH unless ur suggestion wasn't case-sensitive) and PATHEXT.. i tried indepepndently with each of them.. i wrote
;C\TC\TC.EXE(tell me if nething's wrong with it) but to no avail>Moreover I saw another post on Daniweb in which the victim faced the same problem as i do now n he was advised 2 use a different compiler.. Now although this is a good suggestion.. i would appreciate it if sum1 culd actually take the pains 2 explain(and if possible solve that problem) me why even a simple graphics program doesn't work on my home comp but executes without any problem whatsoever on my college comp(i even copied that TC n pasted that in my comp only to end up with same problem!)
Like I said, bad emulation of DOS.
> one of our profs who teaches at Master's level told us that graphics doesn't work on 19" LCD monitors
Find another college, the one you're at has no useful information to teach. Ask him how the hell windows manages to draw on the monitor then.
> The purpose behing me giving all the specifications of my comp was (not 2 blow my own trumpet) 2 clear a few misunderstandings
I couldn't care less about your machine spec.
I was only pointing out that you're NOT making the best use of it.
If you're going to use a 30 year old compiler, then expect problems. It's a problem which is only going to get worse in coming years.
Unless you're planning to be a museum curator, knowing ANYTHING about TC is a waste of effort.
Whilst I could help, I choose not to. In the hope that you'll give up the fossil hunt and just get a modern compiler which actually matches your OS and join the rest of us in the 21st century.
You might figure out what "no longer supported" actually means then.
> one of our profs who teaches at Master's level told us that graphics doesn't work on 19" LCD monitors
Find another college, the one you're at has no useful information to teach. Ask him how the hell windows manages to draw on the monitor then.
> The purpose behing me giving all the specifications of my comp was (not 2 blow my own trumpet) 2 clear a few misunderstandings
I couldn't care less about your machine spec.
I was only pointing out that you're NOT making the best use of it.
If you're going to use a 30 year old compiler, then expect problems. It's a problem which is only going to get worse in coming years.
Unless you're planning to be a museum curator, knowing ANYTHING about TC is a waste of effort.
Whilst I could help, I choose not to. In the hope that you'll give up the fossil hunt and just get a modern compiler which actually matches your OS and join the rest of us in the 21st century.
You might figure out what "no longer supported" actually means then.
•
•
Join Date: Nov 2006
Posts: 224
Reputation:
Solved Threads: 31
ya even i hav a same problem with my friends pc his configration is also very similar i.e.
2GB RAM,Nvidia mobo,Nvidia 512 MB graphic card, win XP pro service pack 2, Intel Core2Duo Processor(2.56GHz) n a 19"W LG LCD screen
n every one gives dose solutions u mentioned,which r of no help tried long bak
he wants it to work desparately @ ne cost
is d 19" lcd really d problem ????
2GB RAM,Nvidia mobo,Nvidia 512 MB graphic card, win XP pro service pack 2, Intel Core2Duo Processor(2.56GHz) n a 19"W LG LCD screen
n every one gives dose solutions u mentioned,which r of no help tried long bak
he wants it to work desparately @ ne cost
is d 19" lcd really d problem ????
--
Index of mp3
Index of mp3
•
•
•
•
>Csurfer, I've also tried out setting system variables as you said.. there were 2 system variables with names path (not PATH unless ur suggestion wasn't case-sensitive) and PATHEXT.. i tried indepepndently with each of them.. i wrote ;C\TC\TC.EXE(tell me if nething's wrong with it) but to no avail
The syntax of the path is also wrong and also the object you choose to include in the path.
Last edited by csurfer; Mar 2nd, 2009 at 2:48 pm.
I Surf in "C"....
Csurfer
Thank you for correcting that Path mistake...
bugmenot
>he wants it to work desparately @ ne cost
is d 19" lcd really d problem ????
19" LCD shud not b a problem..Read Mr. Salem's 2nd post in the same thread.. Also because it works perfectly fine on my friends' 19" LCD VDUs(luk at the irony:many of them are least interested in TC unlike me n yet it works perfectly fine there!!)
death_oclock
My compiler is Turbo C++ 3.0 Borland International (if this is not the answer that you were expecting kindly let me know that)
>It seems you read all the posts about the problem, but none about the solutions.
Most of the people on the net hav done silly errors like
A few of the many pages i visited apart from DaniWeb forums are:
http://www.programmersheaven.com/mb/...ReadPostMode=1
http://www.thinkdigit.com/forum/arch...p/t-50748.html
http://www.codeguru.com/forum/archiv.../t-408756.html
Now, i am not implying that i've not done a silly error.. just that my error and its corresponding SOLUTION is not one of those on the net..
Moreover i can't even view what my graphics error is from the following piece of code which i embed in my simple programs
BECAUSE the screen goes blank n i get the msg "THE NTVDM CPU ENCOUNTERED AN ILLEGAL INSTRUCTION"(which i've already mentioned in this thread b4):
Thank you for correcting that Path mistake...
- I've included Path exactly as per your instructions but the same problem arises as mentioned in my first post.
Hey its just the path variable ( Path ) ok and whenever you are setting a path you don't include exe files to it . You just need to include C:\TC\BIN;C:\TC\LIB;C:\TC\BGI or in total as C:\TC ok . The syntax of the path is also wrong and also the object you choose to include in the path.
- I've also tried changing screen res for the VDU to 800 X 600 in addition to trying out 16 bit n 8 bit color quality. Also i tried running TC.EXE using compatibility settings for 256 colours without an ounce of success
- Mr. Salem has clearly mentioned that its always C:\\TC\\BGI(or whatevr path EGAVGA.bgi is in) in the following thread••••
Well I found this thing in your code:
Help with Code Tags c Syntax (Toggle Plain Text)
Its normally this way:C Syntax (Toggle Plain Text)- initgraph(&gd,&gm,"C:\\TC\\BGI");initgraph(&gd,&gm,"C:\\TC\\BGI");
Help with Code Tags c Syntax (Toggle Plain Text)
C Syntax (Toggle Plain Text)- initgraph(&gd,&gm,"C:\TC\BGI");initgraph(&gd,&gm,"C:\TC\BGI");
http://www.daniweb.com/forums/thread76092.html
bugmenot
>he wants it to work desparately @ ne cost
is d 19" lcd really d problem ????
19" LCD shud not b a problem..Read Mr. Salem's 2nd post in the same thread.. Also because it works perfectly fine on my friends' 19" LCD VDUs(luk at the irony:many of them are least interested in TC unlike me n yet it works perfectly fine there!!)
death_oclock
My compiler is Turbo C++ 3.0 Borland International (if this is not the answer that you were expecting kindly let me know that)
>It seems you read all the posts about the problem, but none about the solutions.
Most of the people on the net hav done silly errors like
C Syntax (Toggle Plain Text)
C:\TC\BGI //instead of C:\\TC\\BGI
http://www.programmersheaven.com/mb/...ReadPostMode=1
http://www.thinkdigit.com/forum/arch...p/t-50748.html
http://www.codeguru.com/forum/archiv.../t-408756.html
Now, i am not implying that i've not done a silly error.. just that my error and its corresponding SOLUTION is not one of those on the net..
Moreover i can't even view what my graphics error is from the following piece of code which i embed in my simple programs
C Syntax (Toggle Plain Text)
errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* return with error code */ }
•
•
Join Date: Mar 2009
Posts: 2
Reputation:
Solved Threads: 0
yeah, I got the same situation.
I changed the path to C:\\TC\\BGI then an error message appear like this:
"16 bit MS-Dos sybsystem
Turbo C++IDE
The NTVDM CPU has encountered an illegal instruction.
CS:0000 IP:00 blah blah"
then I look down to my taskbar, I could saw my program for a moment then it gone.
Could some 1 plz help plz
I changed the path to C:\\TC\\BGI then an error message appear like this:
"16 bit MS-Dos sybsystem
Turbo C++IDE
The NTVDM CPU has encountered an illegal instruction.
CS:0000 IP:00 blah blah"
then I look down to my taskbar, I could saw my program for a moment then it gone.
Could some 1 plz help plz
![]() |
Similar Threads
- BGI Error:- Graphics not Initialized(Use Initgraph) (C)
- error, while using graphics.. (C)
- Help needed in graphics.h (C++)
- bgi error (C)
- Graphics.h turmoil (Game Development)
Other Threads in the C Forum
- Previous Thread: Saving and reading a struct to/from a file ??
- Next Thread: something logical i dont get
| Thread Tools | Search this Thread |
* ansi api array arrays bash binarysearch calculate centimeter changingto char character convert copyanyfile copypdffile creafecopyofanytypeoffileinc createcopyoffile createprocess() dynamic execv fflush file floatingpointvalidation fork forloop frequency function getlogicaldrivestrin givemetehcodez grade graphics gtkwinlinux histogram homework i/o ide inches include infiniteloop initialization input intmain() iso keyboard km license linked linkedlist linux list looping loopinsideloop. lowest matrix microsoft multi mysql oddnumber open opendocumentformat openwebfoundation overwrite pdf pointer pointers posix power program programming pyramidusingturboccodes radix read recursion recv recvblocked reversing scanf scheduling segmentationfault send shape single socketprogramming stack standard strchr string strings suggestions test testautomation testing threads unix urboc user variable whythiscodecausesegmentationfault win32api windowsapi






