dip chit
dip chit

Reputation: 13

Application using the winbgi library crashes when used with Code::Blocks

I am having trouble when trying to run a graphics program through codeblocks. It just opens console and crashes when I click the build&run button. I have tried many other graphics program the result is still the same. And also I tried to debug it and it says segmentation error. See the picture for more details.

picture of the problem

#include <graphics.h>
#include <stdio.h>
#include <conio.h>

int main(void) {
    int gdriver = DETECT, gmode;
    int x1 = 200, y1 = 200;
    int x2 = 300, y2 = 300;
    char driver[] = "";

    initgraph(&gdriver, &gmode, driver);
    line(x1, y1, x2, y2);
    getch();
    closegraph();
    return 0;
}

Upvotes: 1

Views: 97

Answers (0)

Related Questions