Compilation
Michal Pasternak
michal at pasternak.w.lub.pl
Wed Jul 21 01:16:20 PDT 2004
Carlos Torchia [Wed, Jul 21, 2004 at 06:02:43AM +0100]:
> Hi. I can't compile a program using the G2 graphics
> library. When I tried compiling the program the first
> time, cc said it didn't know that g2.h was in
> /usr/local/include, which I think is pretty stupid.
> Anyway, I put /usr/local/include and /usr/local/lib in
> the -I and -L parameters respectively.
Yes, that's correct. You need to pass -I and -L each time you compile a
program, that has its libs / includes not in /usr/{lib,include} .
There are 3 options: use Linux (which has almost everything in /usr/include
and /usr/lib, but you still have to pass -I and -L sometimes, for postgresql
for example); symlink all files in /usr/X11R6/{lib,include} and
/usr/local/{lib,include} in your /usr/{lib,include} - which will clobber up
your filesystem a bit; learn to write / use Makefiles or pkg-config stuff.
For example, you could write Makefile like:
myprogram: myprogram.c
$(CC) -o myprogram `gtk-config --libs --cflags` myprogram.c
> Then it saw
> the header and library files, but there were constant
> errors saying that there were undefined references to
> X11 functions within libg2.a.
Aye! That's why you specify -L/usr/X11R6/lib -lX11 and some more stuff on
gcc command line.
Too hard, too complicated, takes too much time? Well. Either write a good
makefile, or try to learn some IDE for GCC (anjuta, kdevelop), which can
propably take care of this automatically. I think, that learning
automake/autoconf (the scripts, that generate "configure" script, that
autodetects library locations) can be hard/unneeded for you at the moment.
> and how to redirect error output from
> programs to files (or pipe them), because everything I
> need to now about Unix or FreeBSD comes from 72 hours of
> trying to figure out how to make a directory or something.
Google is your friend:
http://www.bo.infn.it/alice/alice-doc/mll-doc/usrgde/node18.html
> I'm sorry, but I just can't do anything in this operating
> system. I mean, finally I've found a library that makes
> it simple to simply plot a pixel in a window without
> spending hours looking for a GTK tutorial that will tell
> me about this stupid graphics context stuff that I don't
> even know. And now I gotta figure out about this stupid
> g2 thing. Ok. Well anyway, thanks for any help you can
> give me.
If you just want to "get the job done", I'd suggest Python. You don't care
about compilation, libraries, other stuff - and it is extremely simple to
draw stuff using PyGTK -
http://www.moeraki.com/pygtktutorial/pygtk2tutorial/ch-DrawingArea.html
If "graphics context" stuff bothers you, well, that's somehow "standard" way
to draw stuff, well, X has it and win32 also has it :) If you want to use
something like a framebuffer, I am sure you can find something, no matter if
in GTK or X11 (I'd suggest XSHM extension for framebuffer-like stuff, but
well, I've written my last pure-X11 application about 5 years ago, and I'm
sure, that things have changed).
Hope this helps. Don't get frustrated - spend another 72 hours actually
reading the docs, unix is simple, but sometimes not as simple, as you may
suppose :)
--
m
More information about the freebsd-questions
mailing list