1

Recently I start a c++ project .For this project I need to use graphics but in CodeBlock I Can't use graphics header file .

here How to use graphics.h in codeblocks? I found a solution but it's does not work. When i simply run this code

#include<graphics.h>
int main(){  

    return 0;
}

It is run with no error.But When I run this code then my program in crushed.

#include<graphics.h>
#include<conio.h>
int main()
{
    int gd=DETECT,gm,left=100,top=100,right=200,bottom=200,x=300,y=150,radius=50;
    initgraph(&gd, &gm, "C:\\TC\\BGI");
    rectangle(left, top, right, bottom);
    circle(x, y, radius);
    bar(left + 300, top, right + 300, bottom);
    line(left - 10, top + 150, left + 410, top + 150);
    ellipse(x, y + 200, 0, 360, 100, 50);
    outtextxy(left + 100, top + 325, "My First C Graphics Program");

    getch();
    closegraph();
    return 0;
}

Give me a solution .

genpfault
  • 51,148
  • 11
  • 85
  • 139
SaikatS
  • 11
  • 4
  • codeblocks not working with graphics.h so good... try visual studio. – Roy Avidan May 28 '17 at 08:02
  • thanks for your Suggestion . Actually i am very noob in programming . I only use codeblock and i have no idea on other IDE . Ok I will try Visual Studio . – SaikatS May 28 '17 at 08:07
  • 4
    "_my program in crushed_" is not a helpful fault report. Please include the error message you are seeing as part of your question. – Rook May 28 '17 at 08:48
  • Possible duplicate of [What can I do if code::blocks shows error when I try to use graphics.h for c/c++?](https://stackoverflow.com/questions/43958082/what-can-i-do-if-codeblocks-shows-error-when-i-try-to-use-graphics-h-for-c-c) – Mukesh M Sep 19 '17 at 12:40

0 Answers0