Here is how I set up libgraph in my Debian Sid:
Downloaded the latest version of libgraph from this site:
http://download.savannah.nongnu.org/releases/libgraph/
First installed some libraries that libgraph depends on:
#apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev
(if you are using other distros like Fedora or Suse, packages 4 these distros are also avalable)
Extarcted the tarball
$tar xvzf libgraph-1.0.2.tar.gz
Then inside the folder ran this:
$./configure
$make
#make install
The default destination for the shared library files is /use/local/lib, if this path is not included in your library path (mine was not) then u have to add that manually in your /etc/ld.so.conf
Our installation is complete now. Now I make a simple test.c with these codes:
#include graphics.h
int main(void)
{
int gd=DETECT, gm=VGAMAX;
initgraph(&gd, &gm, 0);
moveto(0, 0);
rectangle(50,50,500,200);
while (!kbhit());
closegraph();
return 0;
}
[Note: There seems 2 be some problem when I try to put stdio.h inside angled brackets so I'm writing that normally]
Now when we need 2 compile this test.c file we need 2 provide '
$gcc test.c -o test.out -lgraph
Walla! I saw a black window with a rectangle in the middle.
22 comments:
Hey still says graphics.h not found...
What am i supposed to do
can you give me a library of C which handles vertical retrace and has minimal functionalities like drawing circles, polygons which graphics.h provides as supplied by Borland C++.
Platform is DOS and Borland C++
Thanx in advance
HI...........
I did all those installations and the graphics code in getting compiled properly......but its not getting executed...
Its giving following error....,
"./tes.out: error while loading shared libraries: libgraph.so.1: cannot open shared object file: No such file or directory"
When compile libgraph, it writes you where it was installed in. In my case /usr/local/lib. And then I executed command: export LD_LIBRARY_PATH="/usr/local/lib" It seems it is function then to me.
he is debian sid a super set or sub set of fedora...m a ovice andlz help me to install libgraph
does dopin the aforementiond steps install libgarph in fedora...??
excellent tip
works great
hey when I try the ./configure file i get the following error...
checking how to run the C++ preprocessor... /lib/cpp
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
I don't know what it means, can u please help?
Nice post.. i am just going to try my dos game in linux.
well does anyone here know any substitute of conio.h?
i need getch
ifkbhit functions
There are lot more packages to install try the link
http://itsanimesh.com/2009/01/08/c_graphics_in_linux/comment-page-1/#comment-645
What are the differences between UNIX and Linux, and what about all those choices within Linux?
How can insert data into mysql file in a LINUX system from an EXCEL file in WINDOWS machine?
Nicely Put.. Thanks For The Tip... :D
still kbhit() is not recognized....
change initgraph to the following line:
initgraph(&gd,&gm,NULL);
and use getch() instead og kbhit()
What are the criteria to be considered for selecting the LINUX OS to install?
I got following error when i ran the program. and screen get closed.
../../src/xcb_io.c:249: process_responses: Assertion `(((long) (dpy->last_request_read) - (long) (dpy->request)) <= 0)' failed.
Aborted
Plz help me, how to get rid of this problem.
thanks in advance
What are the differences between UNIX and Linux, and what about all those choices within Linux?
"The default destination for the shared library files is /use/local/lib, if this path is not included in your library path (mine was not) then u have to add that manually in your /etc/ld.so.conf"
how do i do that exactly??
Whats the difference between Linux and windows hosting? Do i need Linux on my system to linux host?
How to remove Linux Mint from my flash drive to install a different distro of Linux?
how can we install graphic.h library in fedora 18
Post a Comment