I am trying to compile a program which includes the graphics.h
header file for C. I have added the graphics.h
and winbgim.h
header fil
If you try to compile the source code with including “graphics.h” in code::blocks IDE you have to setup winBGIm
library.
WinBGIm
from http://winbgim.codecutter.org/ or use (direct link)graphics.h
, go to line 302
change int right=0
to int top=0
graphics.h
and winbgim.h
files in include folder of your compiler directory.libbgi.a
to lib folder of your compiler directory Settings
>> Compiler and debugger
>> linker settings
Add
button in link libraries part, browse and select libbgi.a
file -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
Ok
You can also check this video tutorial.
When you're compiling a C source code having graphics.h header file, you'll need to change the file extension to .cpp. Without doing that, you'll get “fatal error: sstream : no such file directory” error.
So, simply change the .c extension to .cpp. Here's a step-by-step procedure to compiling graphics.h source code if you're using Code::Blocks to run the code.
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.