BGI Error: Graphics error

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2008
Posts: 4
Reputation: ravish_26490 is an unknown quantity at this point 
Solved Threads: 0
ravish_26490's Avatar
ravish_26490 ravish_26490 is offline Offline
Newbie Poster

BGI Error: Graphics error

 
0
  #1
Feb 13th, 2009
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.....
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <graphics.h>
  4.  
  5. void main()
  6. {
  7. int gd,gm;
  8. gd=DETECT;
  9. detectgraph(&gd,&gm);
  10. initgraph(&gd,&gm,"C:\\TC\\BGI");
  11.  
  12. line(100,100,200,100);
  13.  
  14. getch();
  15. closegraph();
  16. }

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!!
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 476
Reputation: csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice 
Solved Threads: 76
csurfer's Avatar
csurfer csurfer is offline Offline
Posting Pro in Training

Re: BGI Error: Graphics error

 
0
  #2
Feb 13th, 2009
Well I found this thing in your code:
  1. initgraph(&gd,&gm,"C:\\TC\\BGI");
Its normally this way:
  1. 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"....
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: BGI Error: Graphics error

 
0
  #3
Feb 13th, 2009
> 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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 4
Reputation: ravish_26490 is an unknown quantity at this point 
Solved Threads: 0
ravish_26490's Avatar
ravish_26490 ravish_26490 is offline Offline
Newbie Poster

Re: BGI Error: Graphics error

 
0
  #4
Feb 14th, 2009
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!!
Click image for larger version

Name:	16 bit msdos subsystem.jpg
Views:	5
Size:	15.4 KB
ID:	9226

>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!)
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: BGI Error: Graphics error

 
0
  #5
Feb 14th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 224
Reputation: bugmenot is an unknown quantity at this point 
Solved Threads: 31
bugmenot bugmenot is offline Offline
Posting Whiz in Training

Re: BGI Error: Graphics error

 
0
  #6
Feb 26th, 2009
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 ????
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 357
Reputation: death_oclock will become famous soon enough death_oclock will become famous soon enough 
Solved Threads: 37
death_oclock's Avatar
death_oclock death_oclock is offline Offline
Posting Whiz

Re: BGI Error: Graphics error

 
0
  #7
Feb 26th, 2009
It seems you read all the posts about the problem, but none about the solutions. Computer specs are not the issue. Care to post which compiler you use?
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 476
Reputation: csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice 
Solved Threads: 76
csurfer's Avatar
csurfer csurfer is offline Offline
Posting Pro in Training

Re: BGI Error: Graphics error

 
0
  #8
Mar 2nd, 2009
>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
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.
Last edited by csurfer; Mar 2nd, 2009 at 2:48 pm.
I Surf in "C"....
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 4
Reputation: ravish_26490 is an unknown quantity at this point 
Solved Threads: 0
ravish_26490's Avatar
ravish_26490 ravish_26490 is offline Offline
Newbie Poster

Re: BGI Error: Graphics error

 
0
  #9
Mar 8th, 2009
Csurfer
Thank you for correcting that Path mistake...
  1. 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 included Path exactly as per your instructions but the same problem arises as mentioned in my first post.
  2. 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
  3. Well I found this thing in your code:

    Help with Code Tags c Syntax (Toggle Plain Text)
    1. initgraph(&gd,&gm,"C:\\TC\\BGI");initgraph(&gd,&gm,"C:\\TC\\BGI");
    Its normally this way:

    Help with Code Tags c Syntax (Toggle Plain Text)
    1. initgraph(&gd,&gm,"C:\TC\BGI");initgraph(&gd,&gm,"C:\TC\BGI");
    Mr. Salem has clearly mentioned that its always C:\\TC\\BGI(or whatevr path EGAVGA.bgi is in) in the following thread
    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
  1. C:\TC\BGI //instead of
  2. C:\\TC\\BGI
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
  1. errorcode = graphresult();
  2.  
  3. if (errorcode != grOk) /* an error occurred */
  4. {
  5. printf("Graphics error: %s\n", grapherrormsg(errorcode));
  6. printf("Press any key to halt:");
  7. getch();
  8. exit(1); /* return with error code */
  9. }
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):
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 2
Reputation: duk179 is an unknown quantity at this point 
Solved Threads: 0
duk179 duk179 is offline Offline
Newbie Poster

Re: BGI Error: Graphics error

 
0
  #10
Mar 23rd, 2009
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC