Header Ads

How to run C/C++ graphics programs on Ubuntu

In Ubuntu, we need to  install libgraph library that contains graphics.h header file and other important files to be able to run any graphics program . libgraph is an implementation of the TurboC graphics API (graphics.h) on GNU/Linux using SDL.

Follow these steps to install libgraph on ubuntu:

  1. Open terminal. (ctrl + shift + T). Copy paste the following command. It will download and update the packages in your system. (it requires Internet connection).

    sudo apt-get update



  2. After that execute the following command to install SDL(Simple DirectMedia Layer) packages.

    sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev



  3. Now, download libgraph package from here

  4. Extract that file and open the extracted folder and right click on empty space and click open in terminal.In terminal execute following commands one by one:

    . /configure

    sudo make install

    sudo cp /usr/local/lib/libgraph.* /usr/lib



  5. You have successfully installed libgraph package.
    You can compile a graphics program by typing following commands:
    For C++ program

    g++ <program_name>.cpp – lgraph


    For C program:

    gcc <program_name>.c – lgraph



  6. To run the program, use following command

    ./a.out



6 comments:

  1. […] Learn how to run C/C++ graphics programs on Ubuntu here […]

    ReplyDelete
  2. […] Learn how to run C/C++ graphics programs on Ubuntu here […]

    ReplyDelete
  3. Getting a little recognition on the W3 is hard, even in a distinct segment market (especially in a distinct segment market). You have less than 10 seconds to convince a website visitor to hang in there good enough to understand about the grade of your services, your products or your message. website design melbourne

    ReplyDelete
  4. I can recommend primarily decent and even responsible tips, as a result view it: clipping path service

    ReplyDelete

Powered by Blogger.