Reputation: 3
I'm a new user here so I'll be grateful for your patience and all advices. When I call make, I get an error:
gcc main.o func.o -m32 -o prog
main.o:main.c:(.text+0x56): undefined reference to '_fractal"
collect2: ld returned 1 exit status
Here's my makefile:
CC = gcc
OBJ = main.o func.o
BIN = prog
CFLAGS = -m32
$BIN: $(OBJ)
$(CC) $(OBJ) $(CFLAGS) -o $(BIN)
main.o: main.c
$(CC) $(CFLAGS) -c main.c -o main.o
func.o: func.s
nasm -f elf func.s
I have main.c and func.s files. Anybody could explain me what's wrong and how to fix it?
Upvotes: 0
Views: 847
Reputation:
C uses underscore prefix for function calls.
Haven't you used fractal
instead of _fractal
in your external assembly module?
Upvotes: 1