From owner-freebsd-questions@FreeBSD.ORG Wed Jul 21 08:16:19 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E6EF316A4CE for ; Wed, 21 Jul 2004 08:16:19 +0000 (GMT) Received: from pr93.lublin.sdi.tpnet.pl (pr93.lublin.sdi.tpnet.pl [217.97.36.93]) by mx1.FreeBSD.org (Postfix) with SMTP id 503D143D31 for ; Wed, 21 Jul 2004 08:16:18 +0000 (GMT) (envelope-from michal@pasternak.w.lub.pl) Received: (qmail 2507 invoked by uid 1000); 21 Jul 2004 10:20:03 -0000 Date: Wed, 21 Jul 2004 12:20:03 +0200 From: Michal Pasternak To: Carlos Torchia Message-ID: <20040721102003.GA2433@pasternak.w.lub.pl> References: <20040721050243.9DFF7398198@ws5-1.us4.outblaze.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: <20040721050243.9DFF7398198@ws5-1.us4.outblaze.com> cc: questions@freebsd.org Subject: Re: Compilation X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Michal Pasternak List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jul 2004 08:16:20 -0000 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