我無法正確連接示例程序(在本例中是針對ICU庫)。當我做'做'時,一切都很好。但是當我運行它時,它說它找不到.so的一個。我再次檢查他們都安裝在/ usr/local/lib中。我發現它是在/ usr/lib中查找的。如果我從那裏符號鏈接到那裏的實際位置,它的作品。LIBPATHS未在Makefile中使用,無法找到共享對象
爲什麼我的LIBPATHS被忽略或不被使用?
這裏是Makefile中
CC = g++
INCPATHS = -I/usr/local/include
CFLAGS = -c -Wall $(INCPATHS)
LIBPATHS = -L/usr/local/lib/
LIBS = $(LIBPATHS) -licuio -licui18n -licuuc -licuio -licudata
EXECUTABLE = prog
print_linking = echo -e "\033[32m" "Linking: $<" "\033[39m"
print_compiling = echo -e "\033[33m" "Compiling: $<" "\033[39m"
print_cleaning = echo -e "\033[31m" "Cleaning: `pwd`" "\033[39m"
all: main
# [target]: [dependencies]
# <tab> system command
main: main.o
@$(print_linking)
@$(CC) -o $(EXECUTABLE) main.o $(LIBS) >> /dev/null
main.o: main.cpp
@$(print_compiling)
@$(CC) $(CFLAGS) main.cpp
clean:
@$(print_cleaning)
@rm -rf *.o *~ $(EXECUTABLE)