[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: -lX11



On Tue, May 30, 2000 at 12:52:36PM +0800, Kreaped Ripping Reaper wrote:
> -L/usr/X11/lib wont work but
> 
> yeah it worked... my question now is... how do i compile something
> that needs no path? i mean the -L/usr/X11R6/lib

Eventually, you are going to have to bite the bullet and write a
Makefile.  That's what I would suggest you do to solve this problem.
An example would be:

ldflags = -lX11 -lm
lddirs = -L/usr/X11R6/lib

xroy: xroy.c 		#and whatever else it depends on.
	gcc $(lddirs) $(ldflags) -o xroy xroy.c

clean:
	rm -f xroy

.PHONY: clean

I'm trying to keep this very simple for sake of example, so you should
be able to see what's going on.  The first two lines are assignments.
The fourth and fifth are the most important.  They tell make, "If xroy.c
has been updated more recently than xroy, run the command on the fifth
line."  Notice the tabs in front of the commands.  They are obligatory.
The last few lines tell make, "If someone types 'make clean', then
(always) rm -f xroy.  Also, clean is not an actual file."

I know make might seem overkill right now, but if you wait to learn how
to use it until you have a project with hundreds of C files and no
makefiles, you are going to regret it.    

Cheers,
Chris

-- 
pick, pack, pock, puck: like drops of water in a fountain falling
softly in the brimming bowl.



Reply to: