For using graphics.h library in Ubuntu, you need to follow few simple steps given below:
First of all, you need to install few packages. For that, run command this on your terminal “sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev”
Next you need to install libgraph package. Download libgraph-1.0.2.tar.gz from link:
Extract this where you want. Now navigate to the folder, where you just extracted your libgraph-1.0.2.tar.gz using cd command. Run these commands on your terminal.
> cd libgraph-1.0.2
> sudo make install
> sudo cp /usr/local/lib/libgraph.* /usr/lib
And if you got error message “configure: error: *** SDL version 1.2.0 not found!”, try installing it using: “sudo apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev”
Another error which you can get is: “configure: cannot find guile-config; is Guile installed?” Solve this by using command“sudo apt-get install guile guile-dev”.
If this didn’t helped much, then we have another way to get it work in right way. Use synaptic package manager to install related files.
Now try compliling your C program.
setcolor(12); //outline heart
floodfill(50,50,12); //fill heart