Error due to #include<graphics.h>
graphics.h
is a non-standard header. Most likely it refers to the old BGI graphics library of the Turbo C DOS compiler. It will only work on that particular compiler. And of course DOS is a completely obsolete OS nowadays.
If you are interested in 3D graphics programming, then OpenGL and/or DirectX are indeed better, modern alternatives, supported by many compilers.
If you try to compile the source code with including “graphics.h” in code::blocks IDE you have to setup winBGIm
library.
- Download
WinBGIm
from http://winbgim.codecutter.org/ or use (direct link) - Extract it.
- Open
graphics.h
, go to line302
changeint right=0
toint top=0
- Copy
graphics.h
andwinbgim.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, browse and selectlibbgi.a
file - In right part (ie. other linker options) paste commands
-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
- Click
Ok
You can also check this video tutorial.