Unable to run graphics program in C..

Discussion in 'Programming' started by sauravgr8, Oct 11, 2007.

  1. #1
    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();
    }
     
    sauravgr8, Oct 11, 2007 IP
  2. wizardgp

    wizardgp Banned

    Messages:
    206
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try this this one will be ok

    #include<stdio.h>
    #include<conio.h>
    #include<graphics.h>
    void main()
    {
    int gd=DETECT,gm;
    initgraph(&gd,&gm,"");
    setbkcolor(RED);
    getch();
    }
     
    wizardgp, Oct 12, 2007 IP
  3. sauravgr8

    sauravgr8 Peon

    Messages:
    556
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Have already tried this , but its till not working. Is there any problem in the initialization of graphics driver in my system??
     
    sauravgr8, Oct 12, 2007 IP
  4. digipren

    digipren Active Member

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Maybe you can try to specify the path of the bgi folder :
    Initgraph(&gd,&gm,"[put the path here : c:\\...]");
     
    digipren, Oct 13, 2007 IP