作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以我正在尝试编译我的应用程序(注意:我的第一个 makefile)并且我已经验证了这些库在/usr/lib 中,所以我真的不确定为什么在运行 make 时会出现这个错误:
Linking bin/Pathing...
/usr/bin/ld: cannot find -llibboost_filesystem
/usr/bin/ld: cannot find -llibboost_thread-mt
/usr/bin/ld: cannot find -llibboost_system
collect2: ld returned 1 exit status
make: *** [bin/Pathing] Error 1
# this variable is used to set the executable name
APP = Pathing
# this variable is used to set the extension of files to be compiled
SRCEXT = cpp
#this variable sets to top files hierarchy
SRCDIR = Pathing
# intermediate object files will be organized under this directory (value of OBJDIR)
OBJDIR = obj
#Executable file will be under $BINDIR
BINDIR = bin
#This command will look for all source files to be compiled
SRCS := $(shell find $(SRCDIR) -name '*.$(SRCEXT)')
#this command is used to determine the subdiretories tree
SRCDIRS := $(shell find . -name '*.$(SRCEXT)' -exec dirname {} \; | uniq)
OBJS := $(patsubst %.$(SRCEXT),$(OBJDIR)/%.o,$(SRCS))
DEBUG = -g
INCLUDES = -I./libs/PlistCpp/src -I/usr/local/include/thrift -I./thrift/gen-cpp -I./Pathing -I./libs/Detour -I./libs/DetourCrowd -I./libs/DetourTileCache
CFLAGS = -DHAVE_NETINET_IN_H -Wall -pedantic -ansi -c $(DEBUG) $(INCLUDES)
LDFLAGS = -L/usr/lib -llibboost_filesystem -llibboost_thread-mt -llibboost_system
ifeq ($(SRCEXT), cpp)
CC = $(CXX)
else
CFLAGS += -std=gnu99
endif
.PHONY: all clean distclean
all: $(BINDIR)/$(APP)
$(BINDIR)/$(APP): buildrepo $(OBJS)
@mkdir -p `dirname $@`
@echo "Linking $@..."
@$(CC) $(OBJS) $(LDFLAGS) -o $@
$(OBJDIR)/%.o: %.$(SRCEXT)
@echo "Generating dependencies for $<..."
@$(call make-depend,$<,$@,$(subst .o,.d,$@))
@echo "Compiling $<..."
@$(CC) $(CFLAGS) $< -o $@
clean:
$(RM) -r $(OBJDIR)
distclean: clean
$(RM) -r $(BINDIR)
buildrepo:
@$(call make-repo)
define make-repo
for dir in $(SRCDIRS); \
do \
mkdir -p $(OBJDIR)/$$dir; \
done
endef
# usage: $(call make-depend,source-file,object-file,depend-file)
define make-depend
$(CC) -MM \
-MF $3 \
-MP \
-MT $2 \
$(CFLAGS) \
$1
endef
-rw-r--r-- 1 root root 48666 2011-06-03 16:30 libboost_system.a
lrwxrwxrwx 1 root root 17 2011-06-03 16:30 libboost_system-mt.a -> libboost_system.a
lrwxrwxrwx 1 root root 25 2011-06-03 16:30 libboost_system-mt.so -> libboost_system.so.1.46.1
lrwxrwxrwx 1 root root 25 2011-06-03 16:30 libboost_system.so -> libboost_system.so.1.46.1
-rw-r--r-- 1 root root 14568 2011-06-03 16:30 libboost_system.so.1.46.1
最佳答案
想通了,从库名中删除“lib”...
关于ubuntu -/usr/bin/ld : cannot find -llibboost_filesystem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11526546/
所以我正在尝试编译我的应用程序(注意:我的第一个 makefile)并且我已经验证了这些库在/usr/lib 中,所以我真的不确定为什么在运行 make 时会出现这个错误: Linking bin/P
我是一名优秀的程序员,十分优秀!