graphics.h

I found a thread telling me how to incorporate Borland graphics in to codeblocks. The answer was provided by Duoas. Can anyone tell me if this will work on 64 bit windows 7. I'm trying to resurrect and modify some programs I wrote many years ago which model steam engine valve gears
Well for borlands 5.5, its already set up in codeblocks. Put the borlands compiler folder on C: and set the compiler on your projects build options.'

*Yea it will work if the compiler used is above 4.5 (windows 95), but if its lower than it, like really old, you will probably need to use dos or OS/2, here's a neat article that could help you: http://fabiensanglard.net/Compile_Like_Its_1992/index.php
Last edited on
I've got various versions of Borland C++ and C++ builder on CD, but they all are for 32 bit. I could download borland 5.5 , but their website says it only works on 32 bit. I'm on 64. Latest version of Borland is way out of my affordable range
The WinBGIm library is designed for use with a modern GCC compiler. (C::B uses the GCC by default.)

The old Borland C++ stuff is for 16/32 bit stuff, and probably not what you want.
I've been trawling the web and WinBGIm does look ideal. However several website say 'WinBGIm may not work with 64 bit windows 7'. Has this been sorted?
I've followed the instructions at
http://www.codeincodeblock.com/2011/09/how-to-setup-winbgim-library-in.html

First download WinBGIm from http://winbgim.codecutter.org/
Extract it.
Copy graphics.h and winbgim.h files in include folder of your compiler directory
Copy libbgi.a to lib folder of your compiler directory
In code::blocks open Settings >> Compiler and debugger >>linker settings
click Add button in link libraries part and browse and select libbgi.a file
In right part (ie. other linker options) paste commands
-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
click Ok

Then copied a demo programme from
http://www.programmingsimplified.com/c/graphics.h#programs

When I try to compile it I get the following errors in graphics.h
302 error; redefinition of 'int right'
302 error; 'int right' previously declared here
in function 'int Main()':
8 warning deprecated conversion from string constant to 'char*' [-Wwrite-strings]

It looks to me as tho line 302 which now reads
int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX,
should be
int left=0, int top=0, int right=INT_MAX, int bottom=INT_MAX,
but codeblocks won't let me change it

Sorry to be so useless but it's many years since I did any of this stuff and it makes my old head hurt. Got to do something to keep the grey cells active though. Can anyone help
Last edited on
OK I've worked out how to edit graphics.h, copy it somewhere else, change it using wordpad, then copy it back, and it now compiles, but then crashes,saying eric.exe has stopped working. Now I'm really lost
I still get the warning in main which is
#include <graphics.h>

int main()
{
int gd = DETECT, gm;
int x = 320, y = 240, radius;

initgraph(&gd, &gm, "C:\\TC\\BGI");

for ( radius = 25; radius <= 125 ; radius = radius + 20)
circle(x, y, radius);

getch();
closegraph();
return 0;
}
the warning refers to the initgraph..... line
Last edited on
More progress
I've worked out that initgraph(&gd, &gm, "C:\\TC\\BGI"); is wrong and should be initgraph(&gd, &gm, ""); but then when I try to compile it I get ..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a||No such file or directory|
I've checked and the requisite file seems to be there.
If I go into properties it says that 'file may be blocked.....' so I click unblock, but it doesn't seem to work, as next time I click properties I get the same message.
I've googled how to unblock and it really made my head hurt
Just use damn dosbox.
Topic archived. No new replies allowed.