我的makefile(不是我写的)如下
SOURCES = $(wildcard *.cpp)
OBJECTS = $(SOURCES:.cpp=.o)
DEPENDS = $(SOURCES:.cpp=.d)
LDFLAGS = $(shell pkg-config --libs gtkmm-2.4 gtkglextmm-1.2 lua5.1) -llua5.1
CPPFLAGS = $(shell pkg-config --cflags gtkmm-2.4 gtkglextmm-1.2 lua5.1)
CXXFLAGS = $(CPPFLAGS) -W -Wall -g
CXX = g++
MAIN = game
all: $(MAIN)
depend: $(DEPENDS)
clean:
rm -f *.o *.d $(MAIN)
$(MAIN): $(OBJECTS)
@echo Creating $@...
@$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
%.o: %.cpp
@echo Compiling $<...
@$(CXX) -o $@ -c $(CXXFLAGS) $<
%.d: %.cpp
@echo Building $@...
@set -e; $(CC) -M $(CPPFLAGS) $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
include $(DEPENDS)
现在我想链接当前目录中的libfmodex.so,我尝试将它放在代码中的某个地方用-L。 libfmodex.so,但gcc说g ++:错误:libfmodex.so:没有这样的文件或目录,但我知道它在当前目录中,我究竟如何链接它?
答案 0 :(得分:0)
添加LDFLAGS
变量,例如:-L. -lfmodex