Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Feb 1997 17:22:31 +1100
From:      David Nugent <davidn@labs.usn.blaze.net.au>
To:        Randy DuCharme <randyd@nconnect.net>
Cc:        questions@freebsd.org
Subject:   Re: How do I set include paths?
Message-ID:  <19970211172231.09620@usn.blaze.net.au>
In-Reply-To: <32FFF91A.41C67EA6@nconnect.net>; from Randy DuCharme on Feb 02, 1997 at 10:44:10PM
References:  <32FFF91A.41C67EA6@nconnect.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Feb 02, 1997 at 10:44:10PM, Randy DuCharme wrote:
> #include <X11/Xos.h>
> #include <x11/Xlib.h>
~
> % gcc -g  -c foo.c
> 
> On a 2.1.6 machine I have at work, the above would compile, but on my
> 3.0-current machine at home, I get.....
> 
> foo.c:12: X11/Xos.h: No such file or directory
> foo.c:13: x11/Xlib.h: No such file or directory
> ...
> *** Error code 1
> 
> Stop.
> 
> Now if I do a...
> 
> % gcc -g -I/usr/X11R6/include -c foo.c 
>  
> it works. 

As it should.

I suspect that your 2.1.6 machine has a symlink from
/usr/include/X11 to /usr/X11R6/include/X11. However, this
isn't standard for X programs even if it happens to work on
that machine and you run into exactly the problem you're
seeing - it "magically" works on one machine and not
others configured in precisely the same manner. You
really do need the -I/usr/X11R6/include for it to work
on any machine with the X programmers toolkit installed.


> Is there an environment variable I can set to change
> this?... I feel really stupid asking this, but it's
> driving me buggy.  Regrettably, I'm used to VC++, and
> Borland's products for DOS / Windows.  They did all of
> this stuff for me.  

That's often a problem in itself - detach the programmer more
from the environment and all you encourage is ignorance about
the underlying process. Ultimately it ends up wasting more
time than otherwise for anything that you're doing that is in
any way non-standard (as defined by those environments).

Use make. And with X11 programs in particular, you might want
to look at imake and xmkmf.

If you want an easy way to include X11's environment, then
(assuming {t}csh);

	setenv CFLAGS "-O -g -I/usr/X11R6/include"

then,

	make foo.o

Using a Makefile is usually a better approach since it saves
having to fiddle with the environment whenever you switch
projects.


Regards,

David Nugent - Unique Computing Pty Ltd - Melbourne, Australia
Voice +61-3-9791-9547  Data/BBS +61-3-9792-3507  3:632/348@fidonet
davidn@freebsd.org davidn@blaze.net.au http://www.blaze.net.au/~davidn/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970211172231.09620>