Here's how to install it in ubuntu:
1. Install the libgraph tar.gz file from here.
2. Next you need to install some dependencies , i.e packages:
libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev (For fedora it's SDL-image and SDL-imagedev and the rest two are same)
3. After that you need to extract the downloaded tar and cd to it.
4. Next perform these:
(i). ./configure
(ii) make
(iii) make install
5. Next you need to copy all the libgraph shared files from /usr/local/lib to /usr/lib ,i.e
sudo cp /usr/local/lib/libgraph.* /usr/lib
That's it! now you may run any programme using graphics.h library and see the resutls. ;)
Here's a sample programme to draw a rectangle :
#include stdio.h // please put in angle brackets, there was some problem while posting
#include graphics.h // --do--
int main(void)
{
int gd=DETECT, gm=VGAMAX; // gd is the device driver , gm is the graphics mode
initgraph(&gd,&gm,NULL); // to initialize the graph
moveto(0, 0);
rectangle(50,50,500,200);
while (!kbhit());
closegraph();
return 0;
}
Note:For running the programme you must use the lgraph flag with gcc i.e if the programme is test.c then use gcc test.c -lgraph
For more details you may check out : this
Let the source be open :)
For Fedora please use below command :
ReplyDeleteyum install SDL_image SDL_image-devel.i686 guile.i686 guile-devel.i686
yes but don't forget to be the super user and for ubuntu it's:
ReplyDeletesudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev
INclude Screenshots...There are many users Who do not understand these tech..s
ReplyDelete@RenJith: Thanks for your suggestion. i think the information is self explanatory to someone whose into(or even novice) in graphics programming.The rest are just basic linux commands of installing a package through command lines.Still i could have provided screenshots but presently i'm not into it.
ReplyDelete