lex & yacc questions

Peter da Silva peter at ficc.ferranti.com
Wed Aug 22 02:24:20 AEST 1990


Assuming you're using a compiler that uses Ritchie-compiler style
switches (say, a UNIX compiler), which is implied by the reference
to /lib/libc.a:

In article <266 at cti1.UUCP> mpledger at cti1.UUCP (Mark Pledger) writes:
> When I compile then link using the command line options below, I
> always get the "environ" referencing error.  The only way I've

When you use the "-c" that means "don't link". When you specify the
two file names, that means "link". You have confused the compiler.

Make is your friend. Build a makefile that looks sort of like this:

	OFILES= main.o lex.yy.o

	prog: $(OFILES)
		$(CC) $(CFLAGS) -o prog $(OFILES)

This will compile each program -c to generate a .o file, then link
your .o files together.
-- 
Peter da Silva.   `-_-'
+1 713 274 5180.   'U`
peter at ferranti.com



More information about the Comp.lang.c mailing list