2012-07-17 72 views
0

所以我想編譯我的應用程序(注意:我的第一個makefile),並且我驗證了這些庫位於/ usr/lib中,所以我真的不確定/usr/bin/ld:找不到-llibboost_filesystem

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 

相關線路: LDFLAGS = -L/usr/lib目錄-llibboost_filesystem -llibboost_thread-MT -llibboost_system

你看到任何東西,爲什麼當我運行使我得到這個錯誤在這裏明顯錯誤? (試圖在64位的Ubuntu編譯11.10如果它很重要...)

對於那些好奇的整個生成文件:

# 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 [email protected]` 
     @echo "Linking [email protected]..." 
     @$(CC) $(OBJS) $(LDFLAGS) -o [email protected] 

$(OBJDIR)/%.o: %.$(SRCEXT) 
     @echo "Generating dependencies for $<..." 
     @$(call make-depend,$<,[email protected],$(subst .o,.d,[email protected])) 
     @echo "Compiling $<..." 
     @$(CC) $(CFLAGS) $< -o [email protected] 

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 

這裏是顯示在/ usr/lib目錄中的文件的例子:

-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 

回答

1

想通了,從庫名稱中刪除 「LIB」 ...