Friday, July 27, 2007

Graphics.h in GNU/Linux


Ive read and pondered upon lots of blogs and posts regarding the topics "20xx is the year of the linux desktop" , "linux is not yet ready for the desktop" etc etc.I guess the answer to all such questions is personal in nature. I mean id say "try and find out". I started using a GNU/Linux distribution about 8 months ago. Since then my aim was to do whatever stuff i was doing on XP, on GNU/Linux and maybe find stuff i couldnt do on XP. Thats how i approached/read about GNU/Linux though i later found out that, that approach isn't exactly right, as i was merely "reducing" GNU/Linux to a windows replacement, while its actually a whole another approach to computing.
Anyways, since i joined engineering if there was one thing i didnt like at all, then it was the "Blue Screen Of Death" or the Turbo C interface. Since s3 i never used Turbo C at home. I've always preferred Visual Studio or Dev C++ over Turbo C. I just didnt like the interface. This dislike of turbo C didnt however hamper my coding functionalities in other IDE's as they always had what i wanted. After moving to GNU/Linux i was able to do the same programs and compile them using G++. But s7 is were the problem starts. Now i gotta "computer graphics" lab which makes extensive use of the "graphics.h" library. I had heard rumours earlier that it wasnt available in all IDE's and to my dismay i found out that it wasnt there in GNU/Linux either. Another problem was that since the functions it included involved direct access to the hardware merely copying the graphics.h header to the library folders wouldnt help. As always google helped. Stumbled upon the blog of a person who was in the same situation as I am and he had found a solution. The answer to my problem was a set of libraries called libgraph which wraps around the SDL API.
His blog did contain steps to install in debian but it didnt work for me coz of minor hiccups. SO i spent sometime and finally succeeded in getting it to work on my ubuntu feisty install. I just thought i'd post it here so that google drops this in front of another seeker :)

Step 1: Installing dependencies

run sudo apt-get install build-essential to make sure you have installed all necessary compiler tools

Now comes the real achy part. Open synaptic and install the following packages

libsdl-image1.2
libsdl-image1.2-dev
guile-1.8
guile-1.8-dev
libsdl1.2debian-arts
libartsc0-dev
libaudiofile-dev
libesd0-dev
libdirectfb-dev
libdirectfb-extra
libfreetype6-dev
libxext-dev
x11proto-xext-dev
libfreetype6(upgrade)
libaa1
libaa1-dev
libslang2-dev
libasound2
libasound-dev

You can install them in a single go by adding all the above package names(separated by a black space) to the end of sudo apt-get install Even if it asks you to uninstall some already installed stuff, tell it to proceed. After all this is over. Download this file onto your home folder: libgraph-1.0.1

Right click on the file u just downloaded and click "Extract here"

open terminal and navigate into the folder u just extracted the file contents into by running cd libgraph-1.0.1

Now run the following commands one after the another. Proceed to the next command only if the preceding command executes without any errors.
./configure

sudo make
make install

If you get any errors during the "sudo make" step, paste it in the comments section of this post.

Now technically install is over. Try writing a simple program including graphics.h. Declare the values of gd and gm and call initgraph as follows

int gd,gm=VGAMAX; gd=DETECT; initgraph(&gd,&gm,NULL);

and when compiling using g++ add an extra paramter -lgraph

i.e if you are compiling a program dda.cpp in the terminal u type in

g++ dda.cpp -o dda.o -lgraph

And execute the program by runnung ./dda.o

If on compile it gives u an error that says "could not load shared libraries" or something like that just run the following command and it should fix it

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

I also read somewhere that graphics.h dosen't have ANY practical use in today's world and that its only "use" now is to help students learn to apply different algorithm's they have to study in a paper called "Computer Graphics"


May the source be with you :)

33 comments:

Anonymous said...

i have 2 errors when i wrote sudo make:

Makefile:934: warning: overriding commands for target `libgraph.pc'
Makefile:409: warning: ignoring old commands for target `libgraph.pc'
make all-recursive
make[1]: Entering directory `/home/maryjan/Desktop/libgraph-1.0.2'
Makefile:934: warning: overriding commands for target `libgraph.pc'
Makefile:409: warning: ignoring old commands for target `libgraph.pc'
Making all in doc
make[2]: Entering directory `/home/maryjan/Desktop/libgraph-1.0.2/doc'
Making all in man
make[3]: Entering directory `/home/maryjan/Desktop/libgraph-1.0.2/doc/man'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/maryjan/Desktop/libgraph-1.0.2/doc/man'
make[3]: Entering directory `/home/maryjan/Desktop/libgraph-1.0.2/doc'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/maryjan/Desktop/libgraph-1.0.2/doc'
make[2]: Leaving directory `/home/maryjan/Desktop/libgraph-1.0.2/doc'
make[2]: Entering directory `/home/maryjan/Desktop/libgraph-1.0.2'
Makefile:934: warning: overriding commands for target `libgraph.pc'
Makefile:409: warning: ignoring old commands for target `libgraph.pc'
if /bin/bash ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\""/usr/local/share/libgraph/Font/"\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT libgraph.lo -MD -MP -MF ".deps/libgraph.Tpo" -c -o libgraph.lo libgraph.c; \
then mv -f ".deps/libgraph.Tpo" ".deps/libgraph.Plo"; else rm -f ".deps/libgraph.Tpo"; exit 1; fi
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\"/usr/local/share/libgraph/Font/\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT libgraph.lo -MD -MP -MF .deps/libgraph.Tpo -c libgraph.c -fPIC -DPIC -o .libs/libgraph.o
gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\"/usr/local/share/libgraph/Font/\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT libgraph.lo -MD -MP -MF .deps/libgraph.Tpo -c libgraph.c -o libgraph.o >/dev/null 2>&1
if /bin/bash ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\""/usr/local/share/libgraph/Font/"\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT text.lo -MD -MP -MF ".deps/text.Tpo" -c -o text.lo text.c; \
then mv -f ".deps/text.Tpo" ".deps/text.Plo"; else rm -f ".deps/text.Tpo"; exit 1; fi
gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\"/usr/local/share/libgraph/Font/\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT text.lo -MD -MP -MF .deps/text.Tpo -c text.c -fPIC -DPIC -o .libs/text.o
text.c: In function 'grscanf':
text.c:401: warning: passing argument 1 of 'vsscanf' from incompatible pointer type
text.c:447: warning: passing argument 1 of 'vsscanf' from incompatible pointer type
gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\"/usr/local/share/libgraph/Font/\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT text.lo -MD -MP -MF .deps/text.Tpo -c text.c -o text.o >/dev/null 2>&1
if /bin/bash ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\""/usr/local/share/libgraph/Font/"\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT shapes.lo -MD -MP -MF ".deps/shapes.Tpo" -c -o shapes.lo shapes.c; \
then mv -f ".deps/shapes.Tpo" ".deps/shapes.Plo"; else rm -f ".deps/shapes.Tpo"; exit 1; fi
gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\"/usr/local/share/libgraph/Font/\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT shapes.lo -MD -MP -MF .deps/shapes.Tpo -c shapes.c -fPIC -DPIC -o .libs/shapes.o
gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\"/usr/local/share/libgraph/Font/\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT shapes.lo -MD -MP -MF .deps/shapes.Tpo -c shapes.c -o shapes.o >/dev/null 2>&1
if /bin/bash ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\""/usr/local/share/libgraph/Font/"\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT polygon.lo -MD -MP -MF ".deps/polygon.Tpo" -c -o polygon.lo polygon.c; \
then mv -f ".deps/polygon.Tpo" ".deps/polygon.Plo"; else rm -f ".deps/polygon.Tpo"; exit 1; fi
gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\"/usr/local/share/libgraph/Font/\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT polygon.lo -MD -MP -MF .deps/polygon.Tpo -c polygon.c -fPIC -DPIC -o .libs/polygon.o
gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\"/usr/local/share/libgraph/Font/\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT polygon.lo -MD -MP -MF .deps/polygon.Tpo -c polygon.c -o polygon.o >/dev/null 2>&1
/bin/bash ./libtool --mode=link gcc -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\""/usr/local/share/libgraph/Font/"\" -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -o libgraph.la -rpath /usr/local/lib -version-info 1:2:0 -export-dynamic libgraph.lo text.lo shapes.lo polygon.lo -lm -lSDL_image -L/usr/lib -lSDL
gcc -shared .libs/libgraph.o .libs/text.o .libs/shapes.o .libs/polygon.o -lm /usr/lib/libSDL_image.so -L/usr/lib /usr/lib/libSDL.so -Wl,-soname -Wl,libgraph.so.1 -o .libs/libgraph.so.1.0.2
(cd .libs && rm -f libgraph.so.1 && ln -s libgraph.so.1.0.2 libgraph.so.1)
(cd .libs && rm -f libgraph.so && ln -s libgraph.so.1.0.2 libgraph.so)
ar cru .libs/libgraph.a libgraph.o text.o shapes.o polygon.o
ranlib .libs/libgraph.a
creating libgraph.la
/bin/sed: can't read /usr/lib/libartsc.la: No such file or directory
libtool: link: `/usr/lib/libartsc.la' is not a valid libtool archive
make[2]: *** [libgraph.la] Error 1
make[2]: Leaving directory `/home/maryjan/Desktop/libgraph-1.0.2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/maryjan/Desktop/libgraph-1.0.2'
make: *** [all] Error 2


what i do wrong?

Dave said...
This comment has been removed by the author.
Anonymous said...

root@Muzic-Jukebox:~/Documents/libgraph-1.0.1# gcc test.cpp -o test.o -lgraph
/tmp/ccIdTry3.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
root@Muzic-Jukebox:~/Documents/libgraph-1.0.1#

No output file is being generated.
I am using Gutsy amd64 edition.

Rajiv Nair said...

@anonymous

Install the package libartsc0-dev frmo synaptic and try again.

Rajiv Nair said...

@dave

try running the last linking command mentioned in the post. Also the initgraph line has been messed up by blogger formatting.

it is actually
initgraph(&gd,&gm,NULL);

Anonymous said...

root@Muzic-Jukebox:~# gedit gtest.cpp
root@Muzic-Jukebox:~# gcc gtest.cpp -o gtest.o -lgraph
/tmp/ccZmrGd8.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
root@Muzic-Jukebox:~# cat gtest.cpp

#include "graphics.h"
main()
{
int gd=VGA,gm=VGAHI;
initgraph(&gd,&gm,NULL);
circle(320,240,40);
return 0;
}
root@Muzic-Jukebox:~#

I'm still getting the error. I executed the last line too.I have put the graphics.h in angle brackets in the original program.

Rajiv Nair said...

@dave

try keeping the angled brackets. Also try using the same initializations given in the post. The values for gd and gm i.e

Anonymous said...

main()
{
int a,gd,gm=VGAMAX;gd=DETECT;
initgraph(&gd,&gm,NULL);
circle(100,100,10);
scanf("%d",a);
return(0);
}

This is the main.. The program is compiled and output is generated without errors. When I execute it, I get:

glade@Muzic-Jukebox:~$ ./test.o
Segmentation fault (core dumped)
glade@Muzic-Jukebox:~$

What did I do wrong?

Rajiv Nair said...

@dave

comment out the inigraph and circle function calls and see whether the crash still occurs

Anonymous said...

Yes it does..

Anonymous said...

No.. I checked it out again.. it doesn't.
ow do I use graphics functions then?

Dave said...

when I added a line command and a scanf command, no line was drawn and it endlessly kept taking output for the scanf.

main()
{
int a;
int gd,gm=VGAMAX; gd=DETECT;
initgraph(&gd,&gm,NULL);
scanf("%d",&a);
line(5,5,8,8);
return 0;
}

Dave said...

Actually Saaki is me
-Dave

Unknown said...

Thanx a million! i spent all day today looking for a way to work with graphics.h on ubuntu but to no avail.

then i come across your blog and simply follw all your instructions to the t and presto!! it all works!

Anonymous said...

checking for SDL - version >= 1.2.0... yes
checking SDL ==> SDL_image library... configure: error: *** SDL_image not found
[root@localhost libgraph-1.0.1]#

i am getting the above error, and the installation stops.
why ?

Anonymous said...

Thank you very much!
It works quite well in my system!

Ajay said...

After installing the packages I am getting this errors when i execute sudo make command in directory libgraph-1.0.1

Makefile:781: warning: overriding commands for target `libgraph.pc'
Makefile:333: warning: ignoring old commands for target `libgraph.pc'
make all-recursive
make[1]: Entering directory `/home/ajay/libgraph-1.0.1'
Makefile:781: warning: overriding commands for target `libgraph.pc'
Makefile:333: warning: ignoring old commands for target `libgraph.pc'
Making all in doc
make[2]: Entering directory `/home/ajay/libgraph-1.0.1/doc'
Making all in man
make[3]: Entering directory `/home/ajay/libgraph-1.0.1/doc/man'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/ajay/libgraph-1.0.1/doc/man'
make[3]: Entering directory `/home/ajay/libgraph-1.0.1/doc'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/ajay/libgraph-1.0.1/doc'
make[2]: Leaving directory `/home/ajay/libgraph-1.0.1/doc'
make[2]: Entering directory `/home/ajay/libgraph-1.0.1'
Makefile:781: warning: overriding commands for target `libgraph.pc'
Makefile:333: warning: ignoring old commands for target `libgraph.pc'
/bin/bash ./libtool --mode=link gcc -DFONTDIR=\""/usr/local/share/libgraph/Font/"\" -o libgraph.la -rpath /usr/local/lib -version-info 1:1:0 -export-dynamic libgraph.lo text.lo shapes.lo polygon.lo -lm -lSDL_image -L/usr/lib -lSDL
mkdir .libs
grep: /usr/lib/libesd.la: No such file or directory
sed: can't read /usr/lib/libesd.la: No such file or directory
libtool: link: `/usr/lib/libesd.la' is not a valid libtool archive
make[2]: *** [libgraph.la] Error 1
make[2]: Leaving directory `/home/ajay/libgraph-1.0.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ajay/libgraph-1.0.1'
make: *** [all] Error 2

Rajiv Nair said...

@Ajay

Make sure the packages libesd0 and libesd0-dev are installed. Try again after that

Anonymous said...

when i typed ./configure. I got the following error
root@honey-laptop:/home/honey/libgraph-1.0.1# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets ${MAKE}... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for g++... g++
checking for C++ compiler default output... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets ${MAKE}... (cached) yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking how to recognise dependant libraries... pass_all
checking command to parse /usr/bin/nm -B output... ok
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for ranlib... ranlib
checking for strip... strip
checking for objdir... .libs
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.lo... yes
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking whether the linker (/usr/bin/ld) supports shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether -lc should be explicitly linked in... no
creating libtool
checking for gawk... (cached) mawk
checking target system type... i686-pc-linux-gnu
checking for sdl-config... no
checking for SDL - version >= 1.2.0... no
*** The sdl-config script installed by SDL could not be found
*** If SDL was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the SDL_CONFIG environment variable to the
*** full path to sdl-config.
configure: error: *** SDL version 1.2.0 not found!

plsssssssssss help me

Unknown said...

@honey

Dont run ./configure as root. Just run make install as root. Everything else works fine if u run them with normal user privs.

Unknown said...

:~/Desktop/libgraph-1.0.2$ sudo make
Makefile:934: warning: overriding commands for target `libgraph.pc'
Makefile:409: warning: ignoring old commands for target `libgraph.pc'
make all-recursive
make[1]: Entering directory `/home/kunal/Desktop/libgraph-1.0.2'
Makefile:934: warning: overriding commands for target `libgraph.pc'
Makefile:409: warning: ignoring old commands for target `libgraph.pc'
Making all in doc
make[2]: Entering directory `/home/kunal/Desktop/libgraph-1.0.2/doc'
Making all in man
make[3]: Entering directory `/home/kunal/Desktop/libgraph-1.0.2/doc/man'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/kunal/Desktop/libgraph-1.0.2/doc/man'
make[3]: Entering directory `/home/kunal/Desktop/libgraph-1.0.2/doc'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/kunal/Desktop/libgraph-1.0.2/doc'
make[2]: Leaving directory `/home/kunal/Desktop/libgraph-1.0.2/doc'
make[2]: Entering directory `/home/kunal/Desktop/libgraph-1.0.2'
Makefile:934: warning: overriding commands for target `libgraph.pc'
Makefile:409: warning: ignoring old commands for target `libgraph.pc'
make[2]: Leaving directory `/home/kunal/Desktop/libgraph-1.0.2'
make[1]: Leaving directory `/home/kunal/Desktop/libgraph-1.0.2'
kunal@kunal:~/Desktop/libgraph-1.0.2$ make install
Makefile:934: warning: overriding commands for target `libgraph.pc'
Makefile:409: warning: ignoring old commands for target `libgraph.pc'
make install-recursive
make[1]: Entering directory `/home/kunal/Desktop/libgraph-1.0.2'
Makefile:934: warning: overriding commands for target `libgraph.pc'
Makefile:409: warning: ignoring old commands for target `libgraph.pc'
Making install in doc
make[2]: Entering directory `/home/kunal/Desktop/libgraph-1.0.2/doc'
Making install in man
make[3]: Entering directory `/home/kunal/Desktop/libgraph-1.0.2/doc/man'
make[4]: Entering directory `/home/kunal/Desktop/libgraph-1.0.2/doc/man'
make[4]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/man/man1" || mkdir -p -- . "/usr/local/man/man1"
mkdir: cannot create directory `/usr/local/man/man1': Permission denied
make[4]: *** [install-man1] Error 1
make[4]: Leaving directory `/home/kunal/Desktop/libgraph-1.0.2/doc/man'
make[3]: *** [install-am] Error 2
make[3]: Leaving directory `/home/kunal/Desktop/libgraph-1.0.2/doc/man'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/kunal/Desktop/libgraph-1.0.2/doc'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/kunal/Desktop/libgraph-1.0.2'
make: *** [install] Error 2

Anonymous said...

Hi I have installed everything properly. But when I compile the code using the following command I get the same error that I used to get before installing the aforementioned packages in the article. PLEASE HELP. I have DIP exams next week and I have no clue how I should go about executing my graphics related programs.
****************************************
root@ubuntu:~# g++ dda.cpp -o dda.o -lgraph
In file included from dda.cpp:4:
/usr/include/conio.h:19:19: error: _defs.h: No such file or directory
In file included from dda.cpp:4:
/usr/include/conio.h:56: error: conflicting declaration ‘BLACK’
/usr/local/include/graphics.h:50: error: ‘BLACK’ has a previous declaration as ‘_color BLACK’
/usr/include/conio.h:57: error: conflicting declaration ‘BLUE’
/usr/local/include/graphics.h:50: error: ‘BLUE’ has a previous declaration as ‘_color BLUE’
/usr/include/conio.h:58: error: conflicting declaration ‘GREEN’
/usr/local/include/graphics.h:50: error: ‘GREEN’ has a previous declaration as ‘_color GREEN’
/usr/include/conio.h:59: error: conflicting declaration ‘CYAN’
/usr/local/include/graphics.h:50: error: ‘CYAN’ has a previous declaration as ‘_color CYAN’
/usr/include/conio.h:60: error: conflicting declaration ‘RED’
/usr/local/include/graphics.h:50: error: ‘RED’ has a previous declaration as ‘_color RED’
/usr/include/conio.h:61: error: conflicting declaration ‘MAGENTA’
/usr/local/include/graphics.h:50: error: ‘MAGENTA’ has a previous declaration as ‘_color MAGENTA’
/usr/include/conio.h:62: error: conflicting declaration ‘BROWN’
/usr/local/include/graphics.h:50: error: ‘BROWN’ has a previous declaration as ‘_color BROWN’
/usr/include/conio.h:63: error: conflicting declaration ‘LIGHTGRAY’
/usr/local/include/graphics.h:50: error: ‘LIGHTGRAY’ has a previous declaration as ‘_color LIGHTGRAY’
/usr/include/conio.h:64: error: conflicting declaration ‘DARKGRAY’
/usr/local/include/graphics.h:50: error: ‘DARKGRAY’ has a previous declaration as ‘_color DARKGRAY’
/usr/include/conio.h:65: error: conflicting declaration ‘LIGHTBLUE’
/usr/local/include/graphics.h:50: error: ‘LIGHTBLUE’ has a previous declaration as ‘_color LIGHTBLUE’
/usr/include/conio.h:66: error: conflicting declaration ‘LIGHTGREEN’
/usr/local/include/graphics.h:50: error: ‘LIGHTGREEN’ has a previous declaration as ‘_color LIGHTGREEN’
/usr/include/conio.h:67: error: conflicting declaration ‘LIGHTCYAN’
/usr/local/include/graphics.h:50: error: ‘LIGHTCYAN’ has a previous declaration as ‘_color LIGHTCYAN’
/usr/include/conio.h:68: error: conflicting declaration ‘LIGHTRED’
/usr/local/include/graphics.h:50: error: ‘LIGHTRED’ has a previous declaration as ‘_color LIGHTRED’
/usr/include/conio.h:69: error: conflicting declaration ‘LIGHTMAGENTA’
/usr/local/include/graphics.h:50: error: ‘LIGHTMAGENTA’ has a previous declaration as ‘_color LIGHTMAGENTA’
/usr/include/conio.h:70: error: conflicting declaration ‘YELLOW’
/usr/local/include/graphics.h:50: error: ‘YELLOW’ has a previous declaration as ‘_color YELLOW’
/usr/include/conio.h:71: error: conflicting declaration ‘WHITE’
/usr/local/include/graphics.h:50: error: ‘WHITE’ has a previous declaration as ‘_color WHITE’
/usr/include/conio.h:93: error: expected initializer before ‘_directvideo’
/usr/include/conio.h:97: error: expected initializer before ‘_wscroll’
/usr/include/conio.h:103: error: expected initializer before ‘clreol’
/usr/include/conio.h:104: error: expected initializer before ‘clrscr’
/usr/include/conio.h:105: error: expected initializer before ‘gotoxy’
/usr/include/conio.h:106: error: expected initializer before ‘grgetch’
/usr/include/conio.h:107: error: expected initializer before ‘grgetche’
/usr/include/conio.h:108: error: expected initializer before ‘kbhit’
/usr/include/conio.h:109: error: expected initializer before ‘putch’
/usr/include/conio.h:110: error: expected initializer before ‘wherex’
/usr/include/conio.h:111: error: expected initializer before ‘wherey’
/usr/include/conio.h:114: error: expected initializer before ‘inportb’
/usr/include/conio.h:115: error: ‘_RTLENTRY’ does not name a type
/usr/include/conio.h:116: error: expected initializer before ‘inp’
/usr/include/conio.h:117: error: ‘_RTLENTRY’ does not name a type
/usr/include/conio.h:118: error: expected initializer before ‘outportb’
/usr/include/conio.h:119: error: expected initializer before ‘outport’
/usr/include/conio.h:120: error: expected initializer before ‘outp’
/usr/include/conio.h:121: error: ‘_RTLENTRY’ does not name a type
/usr/include/conio.h:126: error: expected initializer before ‘delline’
/usr/include/conio.h:127: error: expected initializer before ‘gettext’
/usr/include/conio.h:130: error: expected initializer before ‘gettextinfo’
/usr/include/conio.h:131: error: expected initializer before ‘highvideo’
/usr/include/conio.h:132: error: expected initializer before ‘insline’
/usr/include/conio.h:133: error: expected initializer before ‘lowvideo’
/usr/include/conio.h:134: error: expected initializer before ‘movetext’
/usr/include/conio.h:137: error: expected initializer before ‘normvideo’
/usr/include/conio.h:138: error: expected initializer before ‘puttext’
/usr/include/conio.h:141: error: expected initializer before ‘textattr’
/usr/include/conio.h:142: error: expected initializer before ‘textbackground’
/usr/include/conio.h:143: error: expected initializer before ‘textcolor’
/usr/include/conio.h:144: error: expected initializer before ‘textmode’
/usr/include/conio.h:145: error: expected initializer before ‘window’
/usr/include/conio.h:147: error: expected initializer before ‘_setcursortype’
/usr/include/conio.h:148: error: expected initializer before ‘cgets’
/usr/include/conio.h:149: error: expected initializer before ‘cprintf’
/usr/include/conio.h:150: error: expected initializer before ‘cputs’
/usr/include/conio.h:151: error: expected initializer before ‘cscanf’
/usr/include/conio.h:152: error: expected initializer before ‘getpass’
/usr/include/conio.h:153: error: expected initializer before ‘ungetch’
/usr/include/conio.h:163: error: expected initializer before ‘__inportb__’
/usr/include/conio.h:164: error: ‘_RTLENTRY’ does not name a type
/usr/include/conio.h:165: error: expected initializer before ‘__outportb__’
/usr/include/conio.h:166: error: ‘_RTLENTRY’ does not name a type
dda.cpp: In function ‘int main()’:
dda.cpp:10: warning: deprecated conversion from string constant to ‘char*’
dda.cpp:12: error: ‘graphresult’ was not declared in this scope
dda.cpp:13: error: ‘grOk’ was not declared in this scope
dda.cpp:15: error: ‘grapherrormsg’ was not declared in this scope
****************************************

Anonymous said...

@Dave

Use g++ instead of gcc to compile.

Anonymous said...

I cannot install the packages libsdl-image1.2
libsdl-image1.2-dev
guile-1.8
guile-1.8-dev
libsdl1.2debian-arts
libartsc0-dev
libaudiofile-dev
libesd0-dev
libdirectfb-dev
libdirectfb-extra
libfreetype6-dev
libxext-dev
x11proto-xext-dev
libfreetype6(upgrade)
libaa1
libaa1-dev
libslang2-dev
libasound2
libasound-dev

plzz help...I really need the soln badly

varun said...

error during in "make install" :

mv: cannot move `libguile-libgraph.so.0.0.2' to `libguile-libgraph.so.0.0.2U': Permission denied
libtool: install: error: relink `libguile-libgraph.la' with the above command before installing it

thanks,
varunbansl@gmail.com

Torpedo said...

Well, I too am in Trivandrum.. Got my s7 graphics lab this week and stumbled upon your blog, the exact thing that I needed..
But, I was unable to install the following packages- it said not found
libsdl1.2debian-arts
libartsc0-dev
libslang2-dev

Any suggestion on what I can do?

Anonymous said...

After extracted the tarball using $tar xvzf libgraph-1.0.2.tar.gz, I'm not able to run using $./configure.

I'm using Fedora 12. Can anybody tell me how to add the library path in my /etc/ld.so.conf?

Anonymous said...

Hi I'd love to thank you for such a great made site!
I was sure this is a nice way to make my first post!

Sincerely,
Hilary Driscoll
if you're ever bored check out my site!
[url=http://www.partyopedia.com/articles/cars-party-supplies.html]cars Party Supplies[/url].

Anonymous said...

I truly believe that we have reached the point where technology has become one with our world, and I can say with 99% certainty that we have passed the point of no return in our relationship with technology.


I don't mean this in a bad way, of course! Ethical concerns aside... I just hope that as the price of memory decreases, the possibility of uploading our memories onto a digital medium becomes a true reality. It's one of the things I really wish I could see in my lifetime.


(Posted on Nintendo DS running [url=http://kwstar88.livejournal.com/491.html]R4 SDHC[/url] DS NetServ)

Anonymous said...

how risky is dating by the internet [url=http://loveepicentre.com/]professional personals[/url] free trial dating sites http://loveepicentre.com/ athletic fit singles

sanjaykasi said...

In turbo c++, i use :
int gdriver=detect,gmode,errorcode;
initgraph(&gdriver,&gmode,"C:\\tcplus\\BGI");

so whats the equivalent code here??

also you used : int gd,gm=VGAMAX; gd=DETECT; initgraph(&gd,&gm,NULL);

what is the variable "amp"??

Shameer Kappil said...

i installed all packages
am using Debian lenny
after compiling program using -lgraph option,and when u run,i get only this

Unable to init SDL: No available video device

Vishnu Ajit said...

Thanks a lot for your help :)