C++ graphics failing to execute in codeblock

Hi. I have followed all the steps for graphics, getting all the required header files and libraries from http://winbgim.codecutter.org/ and also pasted the linkers. The program compiles fine but the project.exe keeps on crashing on running the codes.
These are the codes I entered. please help me.

1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream> 
#include "graphics.h"

using namespace std;

int main()
{
    initwindow(600, 600);
    circle(300, 300, 50);
    getch();
    return 0;
}
Last edited on
The WinBGIm version you’ve downloaded is bugged.
Following the link you posted you can read:
WinBGIm (Windows BGI - with mouse) version 6.0 is currently maintained and distributed by Michael Main at the University of Colorado http://www.cs.colorado.edu/~main/cs1300/doc/bgi/bgi.html

The new version should be automatically installed (hopefully) together with Code::Blocks EDU-Portable, also known as CodeBlocks-EP:
http://codeblocks.codecutter.org/
(Note if you opt for the portable version, it should not conflict with you existent Code::Blocks installation.)

However, you could also try to follow this suggestion I’ve found on a forum:
a) open “graphics.h”
b) find line 302
int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX,
c) make it equal to line 311
int left=0, int top=0, int right=INT_MAX, int bottom=INT_MAX,

i.e. modify int right=0 into int top=0

save and... good luck!
Please note: I haven’t tried that.

Even if the above suggestion worked, your instruction
getch();
is likely to become your next issue: getch() belongs to "conio.h", another discontinued header.

It looks you’re messing with old and poorly portable stuff, doesn’t it? Is it worth it?

Topic archived. No new replies allowed.