Install graphics.h in ubuntu

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
 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.


int main()

int gd=DETECT,gm;
int i,x=10;
char str[3]=”0″;

setcolor(12); //outline heart

floodfill(50,50,12); //fill heart

return 0;


About Talwinder

Believe in god and hardwork

Posted on October 20, 2013, in Ubuntu. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: