Unable to run graphics program in C..
Menu

digit

 

Results 1 to 19 of 19

Thread: Unable to run graphics program in C..

  1. #1
    Right Off the Assembly Line sauravgr8's Avatar
    Join Date
    Jun 2007
    Posts
    17

    Default Unable to run graphics program in C..

    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();
    }

  2. #2
    Pawned!... Beyond GODLIKE fun2sh's Avatar
    Join Date
    May 2006
    Location
    World Of Warcraft -DOTA
    Posts
    1,062

    Default Re: Unable to run graphics program in C..

    wrong section mate. should be in question n ans section

    wat compiler r u using
    If God has indeed created Himself in His own image, then I submit to you that God is a cockroach :mrgreen:!!!!!!!!

  3. #3
    Console Junkie aditya.shevade's Avatar
    Join Date
    Jun 2006
    Location
    USA
    Posts
    990

    Default Re: Unable to run graphics program in C..

    Quote Originally Posted by fun2sh
    wrong section mate. should be in question n ans section

    wat compiler r u using
    If the programs compiles with graphics.h included, I think it's Borland compiler.
    --- Console Junkie

  4. #4
    Right Off the Assembly Line sauravgr8's Avatar
    Join Date
    Jun 2007
    Posts
    17

    Default Re: Unable to run graphics program in C..

    Quote Originally Posted by fun2sh
    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...

  5. #5
    ||uLtiMaTE WinNER|| Ron's Avatar
    Join Date
    Nov 2006
    Location
    Kathmandu,Nepal
    Posts
    704

    Default Re: Unable to run graphics program in C..

    PicoVico.Com - [URL="http://www.picovico.com"]SlideShow Maker[/URL]

  6. #6
    Alpha Geek adi007's Avatar
    Join Date
    Sep 2007
    Location
    hassan
    Posts
    713

    Default Re: Unable to run graphics program in C..

    try giving .cpp extension to the filename and compile it.
    Last edited by adi007; 19-09-2007 at 03:25 PM.
    ☼ [url=http://www.doiteasily.com]doiteasily.com[/url] ►easy way(s) to do certain things
    [url=http://www.doiteasily.com/search/label/techword]Tech Word of the day : ADSL[/url]
    ☼ [url=http://blog.aditech.info ] Aditech Blog [/url] ► There is something for everyone
    [url=http://blog.aditech.info/search/label/terminalcommand]Terminal Command of the day[/url]

  7. #7
    D i s t i n c t l y Ahead saurabh kakkar's Avatar
    Join Date
    Sep 2006
    Location
    New delhi
    Posts
    495

    Smile Re: Unable to run graphics program in C..

    Quote Originally Posted by sauravgr8
    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

  8. #8
    Right Off the Assembly Line sauravgr8's Avatar
    Join Date
    Jun 2007
    Posts
    17

    Default Re: Unable to run graphics program in C..

    Quote Originally Posted by adi007
    try giving .cpp extension to the filename and compile it.

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

    Quote Originally Posted by saurabh kakkar
    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 by sauravgr8; 20-09-2007 at 01:49 AM. Reason: Automerged Doublepost

  9. #9
    D i s t i n c t l y Ahead saurabh kakkar's Avatar
    Join Date
    Sep 2006
    Location
    New delhi
    Posts
    495

    Smile Re: Unable to run graphics program in C..

    Quote Originally Posted by sauravgr8
    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

  10. #10
    Apprentice gofeddy's Avatar
    Join Date
    Nov 2006
    Posts
    60

    Default Re: Unable to run graphics program in C..

    Quote Originally Posted by sauravgr8
    initgraph(&gd,&gm,"");
    replace this line wit.......initgraph(&gd,&gm,"..\\bgi");

    it might work
    At any moment of time, the BEST thing to do is the RIGHT thing, the NEXT BEST thing is the WRONG thing, and the WORST thing to do is NOTHING

  11. #11
    Wahahaha~!
    Join Date
    Dec 2006
    Location
    Pune/there
    Posts
    8,822

    Default Re: Unable to run graphics program in C..

    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

  12. #12
    die blizzard die! D3? The_Devil_Himself's Avatar
    Join Date
    Aug 2007
    Location
    Event horizon
    Posts
    2,330

    Default Re: Unable to run graphics program in C..

    Quote Originally Posted by gofeddy
    replace this line wit.......initgraph(&gd,&gm,"..\\bgi");

    it might work
    +1.This worked fr me.
    Stealing your women and horses since 1843.

  13. #13
    Wahahaha~!
    Join Date
    Dec 2006
    Location
    Pune/there
    Posts
    8,822

    Default Re: Unable to run graphics program in C..

    Quote Originally Posted by The_Devil_Himself
    +1.This worked fr me.
    just for info
    . is for parent dir
    .. is the present working dir

  14. #14
    Right Off the Assembly Line sauravgr8's Avatar
    Join Date
    Jun 2007
    Posts
    17

    Default Re: Unable to run graphics program in C..

    Quote Originally Posted by saurabh kakkar
    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...

  15. #15
    D i s t i n c t l y Ahead saurabh kakkar's Avatar
    Join Date
    Sep 2006
    Location
    New delhi
    Posts
    495

    Smile Re: Unable to run graphics program in C..

    Quote Originally Posted by sauravgr8
    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++

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

  16. #16
    Console Junkie aditya.shevade's Avatar
    Join Date
    Jun 2006
    Location
    USA
    Posts
    990

    Default Re: Unable to run graphics program in C..

    ^^ Oi... Turbo C/C++ is an IDE (Integrated Development Environment) that uses Borland's C/C++ compiler.
    --- Console Junkie

  17. #17
    D i s t i n c t l y Ahead saurabh kakkar's Avatar
    Join Date
    Sep 2006
    Location
    New delhi
    Posts
    495

    Default Re: Unable to run graphics program in C..

    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

  18. #18
    Right Off the Assembly Line sauravgr8's Avatar
    Join Date
    Jun 2007
    Posts
    17

    Default Re: Unable to run graphics program in C..

    #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

  19. #19
    D i s t i n c t l y Ahead saurabh kakkar's Avatar
    Join Date
    Sep 2006
    Location
    New delhi
    Posts
    495

    Default Re: Unable to run graphics program in C..

    ^^ 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

    File: C++.rar

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

    then run ur Program this time it shud Run
    Last edited by saurabh kakkar; 23-09-2007 at 01:31 AM.

Similar Threads

  1. Replies: 2
    Last Post: 09-05-2009, 10:24 PM
  2. no output for graphics program
    By ebindraj in forum Programming
    Replies: 14
    Last Post: 08-09-2008, 08:59 AM
  3. Graphics program in C
    By zegulas in forum Programming
    Replies: 1
    Last Post: 29-08-2008, 12:00 PM
  4. Unable to run graphics program in C..
    By sauravgr8 in forum Tutorials
    Replies: 18
    Last Post: 23-09-2007, 01:20 AM
  5. new program in 'close program menu' list and more.......
    By vishakadatta in forum QnA (read only)
    Replies: 2
    Last Post: 12-04-2005, 11:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •