参考的makefile
CC = g++
flag = -c -g -Wall -o
objects = ChenYu.o Dictionary.o Index.o mainProgram.o Poem.o Ranking.o StructedDoc.o \
StructedDocSet.o TDInfo.o WordSegmentor.o TextEntity.o
FullText:$(objects)
$(CC) -g -Wall -o FullText $(objects) libSeg.a -lPyAnnotator -L ../lib
cp FullText ../bin
TextEntity.o:TextEntity.h
$(CC) $(flag) TextEntity.o TextEntity.cpp
ChenYu.o:ChenYu.h StructedDoc.h
$(CC) $(flag) ChenYu.o ChenYu.cpp
Dictionary.o:Dictionary.h
$(CC) $(flag) Dictionary.o Dictionary.cpp
Index.o:Dictionary.h StructedDocSet.h StructedDoc.h TDInfo.h Index.h
$(CC) $(flag) Index.o Index.cpp
mainProgram.o:StructedDocSet.h
$(CC) $(flag) mainProgram.o mainProgram.cpp
Poem.o:Poem.h StructedDoc.h
$(CC) $(flag) Poem.o Poem.cpp
Ranking.o:Index.h Dictionary.h
$(CC) $(flag) Ranking.o Ranking.cpp
StructedDoc.o:StructedDoc.h
$(CC) $(flag) StructedDoc.o StructedDoc.cpp
StructedDocSet.o:StructedDocSet.h WordSegmentor.h
$(CC) $(flag) StructedDocSet.o StructedDocSet.cpp
TDInfo.o:TDInfo.h
$(CC) $(flag) TDInfo.o TDInfo.cpp
WordSegmentor.o:WordSegmentor.h
$(CC) $(flag) WordSegmentor.o WordSegmentor.cpp
clean:
rm FullText $(objects)
编译完成后,运行前,还要走这么一步,方能找到动态链接库
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/dev/FullText_test/lib
/dev/FullText_test/lib放置了so动态链接库
转载于:https://www.cnblogs.com/speedmancs/archive/2009/09/24/1573153.html