Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting undefined reference to `floor' on running make in PintOS

Tags:

c

gcc

makefile

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

~

like image 497
Monty Swanson Avatar asked Oct 26 '25 17:10

Monty Swanson


1 Answers

-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.

like image 112
Oliver Charlesworth Avatar answered Oct 28 '25 08:10

Oliver Charlesworth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!