I reply in that OLD thread only because actually i am in the same situation and i found a banal typo error in graphics.h;
downloaded from mantainer's website; i notice too many posts throughout the web refer to that problem;
I suppose that library is quite old and i am wondering how all that time the maintainer prof Main was not aware about
i.e. how no one in the world complained to him --instead complain on the forums-- about that annoyance;
Hopefully now on newcomers (mostly students i guess) will compile and run their winbgim app without that particular
headache
Enjoy
Let's recap
As @WhoAmI reported the following error is presented to me too but the fact is that C:B(Release 13.12 rev 9501 (2013/12/25 19:25:45) gcc 4.7.1 Windows/unicode - 32 bit)/mingw(4.8.1) system is right
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\graphics.h|302|error: redefinition of 'int right'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\graphics.h|302|error: 'int right' previously declared here|
||=== Build finished: 2 errors, 0 warnings ===|
i did a try also with Geany/mingw system and the result was the same(always with same mingw)
g++ -m32 -Wall -std=c++11 -pedantic -g "first-sample.c" -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32 -o "first-sample.exe" (in directory: C:\Documents and Settings\Owner\Επιφάνεια εργασίας\BOB\cources\NPTEL\books\Progr\lang\Cbooks\C50books\test)
In file included from c:\mingw\include\graphics.h:29:0,
from first-sample.c:1:
c:\mingw\include\graphics.h:302:40: error: redefinition of 'int right'
int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX,
^
In file included from first-sample.c:1:0:
c:\mingw\include\graphics.h:302:27: error: 'int right' previously declared here
int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX,
^
Compilation failed.
so my curiosity rise high and i saw that in line 302 graphics.h had a typo error.
... int left=0, int right=0, int right=INT_MAX, int bottom=INT_MAX, ...
to be surest i downloaded the C:B-EP and compare my file with the graphics.h there and definitely my graphics.h ( i had downloaded it from Mainland's Uni page**
http://www.cs.colorado.edu/~main/cs1300-old/cs1300/doc/bgi/bgi.html precisely from
http://www.cs.colorado.edu/~main/bgi/dev-c++/ --because was the first result in google--) had that typo error.
So all we in the world (except maybe the lucky users of CodeBlocks-EP) had an erratic graphics.h file
I notify (i hope main@colorado.edu is a valid/active email address) Michael Main trough an email about that hopefully he will correct it. Meanwhile i hope this post be proficient for who encounter the above mentioned errors
PS:
After have corrected the graphics.h (int right=0 --> int top=0 ) actually the sample program first-sample.cxx compile flawlessly but crash in runtime

. Ok that's another problem.
Instead C:B_EP work as intended;
<edit>
About first-sample.c 's crashing i have followed prof. Main's instructions (download graphics.h , libbgim.a and put them in \include and \lib dirs respectively but Main refers to his CSCI 1300 Software Package instead i put them in mingw's \include and \lib dirs i guess the problem is there; when i have time to see what is going on i post here
<edit\>
<final_edit 18/07/14>
was not a file's placement in the right directories issue but a libbgim.a "oldness" problem (thanks for the hint codeur

) i.e. libbgim.a was too old to live and behave as intended so i downloaded the library's source from
http://winbgim.codecutter.net/ and recompile it with the actual version of mingw (4.8.1) and substitute the freshly
compiled libbgim.a in place of the ancestral libbgim.a(downloaded from the maintainers webpage ) and as if by magic all was tele-transported in our days and worked flawlessly as it should
Prof Micahel Main reply me (15/7/14) a thanking for my advise but up to few minutes ago all his pages related to winbgim library remain as were. Dunno his timing constraints so meanwhile right now I put here as attachment the 2 necessary and sufficient files for use the library i.e. graphics.h and the newly compiled libbgim.a; a bit later i put them in my
account in github too.
Unfortunately here is not permitted upload .h and .a (i am wondered why?) files so after you download the files do not forget to delete the fake *.patch extension in each of them <final_edit\>
**
Many Computer Science faculty have recommended the use of graphics to help
motivate the study of introductory programming and as a vehicle to help students
understand how to use libraries and to call functions.
To reduce the overhead required to introduce graphics, we decided to use
WinBGIm (Windows BGI with the addition of mouse control), which is a package based
on the Turbo Pascal BGI (Borland Graphics Interface) library.
WinBGIm was created to run on top of the Win32 library by Michael Main and his
students at the Computer Science Department, University of Colorado Boulder.
Several development platforms appropriate for CS 1 courses have incorporated
WinBGIm.
Quincy (developed by Al Stevens) is an open-source student oriented
C++ IDE that includes WinBGIm as well as more advanced libraries.
A command-line platform based on the open-source GNU g++ compiler and the
emacs program editor is distributed by the University of Colorado. WinBGIm is
also available for (n.d.r. nowadays deprecated and buggy) Bloodshed Software’s Dev-C++ ,
Microsoft’s Visual Studio C++ (n.d.r and obviously for
Codeblocs - Edu Portable that includes
as well other more advanced libraries) .
excerpt from Hanly-Koffman's
Problem Solving and Program Design in CCheers,
Harry
[attachment deleted by admin]