我的makefile存在问题。
我开发这个挑战,以及这家公司给我的.dylib文件。
所以当我创建我的Makefile时 它是这样的
CC := g++
SRCDIR := src
BUILDDIR := build
TARGET := bin/challenge
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
CFLAGS := -g # -Wall
LIB := -L lib -ldesafio
INC := -I include
$(TARGET): $(OBJECTS)
@echo " $(CC) $^ -o $(TARGET) $(LIB)"; $(CC) $^ -o $(TARGET) $(LIB)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(BUILDDIR)
@echo " $(CC) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $<
clean:
@echo " $(RM) -r $(BUILDDIR) $(TARGET)"; $(RM) -r $(BUILDDIR) $(TARGET)
run:
bin/challenge
.PHONY: clean
我的结构也是正确的 我将这个.dylib文件放到lib /(lib / libdesafio.dylib)
中但是当我编译时 我有此错误消息:
g++ build/main.o -o bin/runner -L lib -ldesafio
Undefined symbols for architecture x86_64:
"pm_register_callback(void (*)(int, unsigned char*, unsigned int))", referenced from:
_main in main.o
"pm_exec(int, unsigned char*, unsigned int)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/runner] Error 1
任何人都可以帮助我吗?
提前致谢