I am trying to run make on a PintOS makefile but I keep getting the undefined reference to `floor' error. The makefile is below. I am running Ubuntu 11.10 with gcc 4.6.1. Any help is appreciated.
all: setitimer-helper squish-pty squish-unix
CC = gcc
CFLAGS = -Wall -W
LDFLAGS = -lm
setitimer-helper: setitimer-helper.o
squish-pty: squish-pty.o
squish-unix: squish-unix.o
clean:
rm -f *.o setitimer-helper squish-pty squish-unix
~
-lm should be in LDLIBS, not LDFLAGS.
The difference is important, because the implicit rule for linking executables is:
$(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS)
and ld (invoked by GCC) has a strict left-to-right dependency-resolution algorithm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With