943,549 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 5030
  • C RSS
You are currently viewing page 1 of this multi-page discussion thread
Feb 13th, 2009
0

BGI Error: Graphics error

Expand Post »
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!!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ravish_26490 is offline Offline
4 posts
since Sep 2008
Feb 13th, 2009
0

Re: BGI Error: Graphics error

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.
Reputation Points: 485
Solved Threads: 88
Posting Pro
csurfer is offline Offline
564 posts
since Jan 2009
Feb 13th, 2009
0

Re: BGI Error: Graphics error

> 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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Feb 14th, 2009
0

Re: BGI Error: Graphics error

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:	897
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!)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ravish_26490 is offline Offline
4 posts
since Sep 2008
Feb 14th, 2009
0

Re: BGI Error: Graphics error

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Feb 26th, 2009
0

Re: BGI Error: Graphics error

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 ????
Reputation Points: 53
Solved Threads: 33
Posting Whiz in Training
bugmenot is offline Offline
224 posts
since Nov 2006
Feb 26th, 2009
0

Re: BGI Error: Graphics error

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?
Reputation Points: 128
Solved Threads: 43
Posting Whiz
death_oclock is offline Offline
389 posts
since Apr 2006
Mar 2nd, 2009
0

Re: BGI Error: Graphics error

Quote ...
>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.
Reputation Points: 485
Solved Threads: 88
Posting Pro
csurfer is offline Offline
564 posts
since Jan 2009
Mar 8th, 2009
0

Re: BGI Error: Graphics error

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. Quote ...
    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):
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ravish_26490 is offline Offline
4 posts
since Sep 2008
Mar 23rd, 2009
0

Re: BGI Error: Graphics error

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
duk179 is offline Offline
2 posts
since Mar 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Exchanging messages through web interface using C connector
Next Thread in C Forum Timeline: Toupper





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC