Unable to run graphics program in C..

Status
Not open for further replies.

sauravgr8

Broken In
I am unable to run even a simplest graphics program in C, even though when i compile the program it shows success but when i run it , it gives the error that the
BGI error: graphics not initialized...
I dont know where is the problem...can any one help plz
#include<stdio.h>
#include<conio.h>
#include<graphics.h.
void main()
{
int gd=DETECT,GM;
initgraph(&gd,&gm,"");
setbkcolor(RED);
getch();
}
 

fun2sh

Pawned!... Beyond GODLIKE
wrong section mate. should be in question n ans section

wat compiler r u using
 
OP
sauravgr8

sauravgr8

Broken In
fun2sh said:
wrong section mate. should be in question n ans section

wat compiler r u using
^^^^
yah its borland compiler, well , now can u suggest me any clue, why its not running...
 

Ron

||uLtiMaTE WinNER||
Post Here
*www.thinkdigit.com/forum/showthread.php?t=67133
To Get Your Answer
 

saurabh kakkar

D i s t i n c t l y Ahead
sauravgr8 said:
I am unable to run even a simplest graphics program in C, even though when i compile the program it shows success but when i run it , it gives the error that the
BGI error: graphics not initialized...

Do this :

ENABLE GRAPHICS BY GOING TO OPTIONS MENU IN TC COMPILER THEN CLICK LINKERS THEN CLICKING [ ]GRAPHICS LIBRARY .DO NOT CHANGE ANY OTHER OPTION.

hope this will help :)

and plz post ur Questions in QnA section
 
OP
sauravgr8

sauravgr8

Broken In
adi007 said:
try giving .cpp extension to the filename and compile it.


I am already using CPP extension , even though its not working:(

saurabh kakkar said:
Do this :

ENABLE GRAPHICS BY GOING TO OPTIONS MENU IN TC COMPILER THEN CLICK LINKERS THEN CLICKING [ ]GRAPHICS LIBRARY .DO NOT CHANGE ANY OTHER OPTION.

hope this will help :)

and plz post ur Questions in QnA section

I tried doing this friend, i left rest of the option as intact, and just removed the cross from graphics library as u said, but still the problem persists:-?
 
Last edited:

saurabh kakkar

D i s t i n c t l y Ahead
sauravgr8 said:
I am already using CPP extension , even though its not working:(



I tried doing this friend, i left rest of the option as intact, and just removed the cross from graphics library as u said, but still the problem persists:-?

are sorry dont remove the cross instead run this program :

Code:
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
setbkcolor(RED);
getch();
}

Problems in ur program

#include<stdio.h>
#include<conio.h>
#include<graphics.h.<----------should be #include<graphics.h>
void main()
{
int gd=DETECT,GM;<-----------should be gm i.e in small
initgraph(&gd,&gm,"");
setbkcolor(RED);
getch();
}

hope this will help
 

Faun

Wahahaha~!
Staff member
Search turbo c/c++ help before drawing out conclusion.

U could hav find the answers if u hav right clicked on graphics.h, then would hav scrolled right to the bottom to see some examples, copy the driver initiaiization part from any of the exaples and give the address of bgi directory. e.g. if ur tc is in c: drive then give
c:\\tc\\bgi
as the path
 
OP
sauravgr8

sauravgr8

Broken In
saurabh kakkar said:
are sorry dont remove the cross instead run this program :

Code:
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
setbkcolor(RED);
getch();
}

Problems in ur program

#include<stdio.h>
#include<conio.h>
#include<graphics.h.<----------should be #include<graphics.h>
void main()
{
int gd=DETECT,GM;<-----------should be gm i.e in small
initgraph(&gd,&gm,"");
setbkcolor(RED);
getch();
}

hope this will help




Sorry , it was just a typing mistake here, but in the borland C i did the way u said ...but still it was not working , i tried all the remedies, even gave the path within that inverted commas, but still its not working...what should i do know...
 

saurabh kakkar

D i s t i n c t l y Ahead
sauravgr8 said:
Sorry , it was just a typing mistake here, but in the borland C i did the way u said ...but still it was not working , i tried all the remedies, even gave the path within that inverted commas, but still its not working...what should i do know...

there is no problem in My program i have executed it in TURBO C++

all i can suggest to is to Dump Borland compiler and use TURBO C++ :D

if u r not able to find TURBO C++ i can upload it for u :)
 

saurabh kakkar

D i s t i n c t l y Ahead
thanks man for the info i was confused i was also thinking that both r same

thing :)

@ sauravgr8 : plz provide the error that u r getting
 
OP
sauravgr8

sauravgr8

Broken In
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:/TC/BIN");
setbkcolor(RED);
getch();
}
this is the program i typed in and saved with .c extension
now when i compile it shows success
but wheni i run it gives an error
UNABLE TO OPEN " TCCLASS.LIB"
now what should i do
 

saurabh kakkar

D i s t i n c t l y Ahead
^^ I have uploaded my Tc compiler extract it using winrar and then install :) By clicking on

INSTALL.EXE then chose the location where u want ur Tc folder then press y on each Q asked

then When done !! comes instalation is complete

then ENABLE GRAPHICS BY GOING TO OPTIONS MENU IN TC COMPILER THEN CLICK LINKERS THEN

CLICKING [X]GRAPHICS LIBRARY . do not remove the [X] if it already exists :D

File: C++.rar

DownloadLink: *rapidshare.com/files/57529675/C__.rar

then run ur Program this time it shud Run :)
 
Last edited:
Status
Not open for further replies.
Top Bottom