Compiling a C-project under RaspBian getting undefined reference to `powf'

28 Views Asked by At

The make-file look like this:

CC=gcc
CFLAGS=-c -Wall

# Define the source files
SRC = wh1080_rf.c bcm2835.c bmp085.c parameters.c

# Define the object files by replacing each SRC .c with .o
OBJ = $(SRC:.c=.o)

# Define the final executable name
EXE = wh1080_rf

all: $(EXE)
     @echo Compilation successful

$(EXE): $(OBJ)
    $(CC) -lm $(OBJ) -o $(EXE)

%.o: %.c %.h
    $(CC) $(CFLAGS) -o $@ $<
    
clean:
    rm -f $(OBJ) $(EXE)

The project is an old one contained in a GIT-repository: https://github.com/Kevin-Sangeelee/wh1080_rf

I cloned it and used it as it is. I tried to add the link directive '-lm' but no success. Would be nice to get some help here.

The error message:

 make all
gcc -lm -c -Wall -o wh1080_rf.o wh1080_rf.c
gcc -lm -c -Wall -o bcm2835.o bcm2835.c
gcc -c -Wall   -c -o bmp085.o bmp085.c
gcc -lm -c -Wall -o parameters.o parameters.c
gcc -lm wh1080_rf.o bcm2835.o bmp085.o parameters.o -o wh1080_rf
/usr/bin/ld: bmp085.o: in function `read_bmp085':
bmp085.c:(.text+0x664): undefined reference to `powf'
collect2: error: ld returned 1 exit status
make: *** [Makefile:17: wh1080_rf] Error 1
0

There are 0 best solutions below