Tuesday 17 March 2015

How to install Libgraph on UBUNTU

●This project is not part of the GNU Project. libgraph is an implementation of the TurboC graphics API (graphics.h) on GNU/Linux using SDL. The library requires SDL for primitive graphics and SDL_image (to blit fonts). Functions for text display are based heavily on code "borrowed" from Karl Bartel's SFont library.
● The library is not very powerful or flexible. It is probably not suitable for use in production-quality applications. I see it more as a simple, easy-to-use 2D graphics interface - could be used for simple prototyping, visualization or studying graphics algorithms. It is simplified library to run graphics programs in C.
It works efficiently with open source C compiler gcc. It is required to add the sdl-libgraph library to current existing gcc
Prerequisite: Internet Connection

You need to install some basic packages. Open terminal and exicute the following commands on terminal.
1) sudo apt-get update 
                 To update your basic packages
2) sudo apt-get install build-essential
                 For installing essential packages.
3) sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev libart-2.0-dev libaudiofile-dev libesd0-dev libdirectfb-dev libdirectfb-extra libfreetype6-dev libxext-dev x11proto-xext-dev libfreetype6 libaa1 libaa1-dev libslang2-dev libasound2 libasound2-dev
                 For installing lib packages
4) Now, download libgraph from: 
(http://download.savannah.gnu.org/releases/libgraph/libgraph-1.0.2.tar.gz). Then copy the file libgraph-1.0.2.tar.gz to our home folder. Right click on the file and select Extract here.
5) Open a terminal and run the following commands, one by one.
cd libgraph-1.0.2
./configure
sudo make
sudo make install
sudo cp /usr/local/lib/libgraph.* /usr/lib+

Now you are ready to compile your program!
● Write your program using any editor and save.
● Open the terminal for the specified folder and then run with:
gcc MyProg.c -lgraph (for C program)
g++ MyProg.cpp -lgraph (for C++ program)
./a.out
● Once all this installation process is done, you don't need to follow this process again and again. Just
compile and execute the program. 

12 comments:

  1. thank you soo much..!!
    it really worked..
    only in the last step ofinstallation (sudo cp /usr/local/lib/libgraph.*/usr/lib) should be there
    the '+' sign after that should not be there..
    otherwise it is cool

    ReplyDelete
  2. Hello, when I take the second step I can not follow someone I could help?

    ReplyDelete
  3. cp: target '/usr/lib+' is not a directory
    getting this error

    ReplyDelete
  4. i got make command not found error

    ReplyDelete
  5. when I type in commands for third step, the terminal shows error could not find package guile-1.8-dev. Please can you help me out with this?

    ReplyDelete
  6. I get the guile file error too. anyone have an idea?

    ReplyDelete
  7. use this command as step 3 for new libgraph

    sudo apt install libsdl-image1.2 libsdl-image1.2-dev guile-2.0 guile-2.0-dev libsdl1.2debian libart-2.0-dev libaudiofile-dev pulseaudio-esound-compat libdirectfb-dev libdirectfb-extra libfreetype6-dev libxext-dev x11proto-xext-dev libfreetype6 libaa1 libaa1-dev libslang2-dev libasound2 libasound2-dev

    ReplyDelete