4
我想編譯一段代碼創建一個TNonblockingServer,我得到以下編譯錯誤。任何想法有什麼不對?Apache thrift未定義的參考apache :: thrift :: server :: TNonblockingServer
something_server.cpp:(.text+0x1ad): undefined reference to `apache::thrift::server::TNonblockingServer::serve()'
something_server.cpp:(.text+0x1c1): undefined reference to `apache::thrift::server::TNonblockingServer::~TNonblockingServer()'
something_server.cpp:(.text+0x280): undefined reference to `apache::thrift::server::TNonblockingServer::~TNonblockingServer()'
我在安裝節儉時執行了這裏列出的步驟。 http://thrift.apache.org/docs/install/os_x/
這裏是我的makefile
GEN_SRC := Something.cpp something_constants.cpp something_types.cpp
GEN_OBJ := $(patsubst %.cpp,%.o, $(GEN_SRC))
THRIFT_DIR := /usr/local/include/thrift
BOOST_DIR := /usr/local/include
INC := -I$(THRIFT_DIR) -I$(BOOST_DIR)
.PHONY: all clean
all: something_server something_client
%.o: %.cpp
$(CXX) -Wall -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H $(INC) -c $< -o [email protected]
something_server: something_server.o $(GEN_OBJ)
$(CXX) $^ -o [email protected] -L/usr/local/lib -lthrift
something_client: something_client.o $(GEN_OBJ)
$(CXX) $^ -o [email protected] -L/usr/local/lib -lthrift
clean:
$(RM) *.o something_server something_client
由於未鏈接庫,這看起來像一個普通的鏈接問題。你如何編譯和鏈接? – comocomocomocomo 2013-03-08 07:45:38
我編輯了這個問題並添加了我的makefile。 – 2013-03-08 07:47:11
嘗試添加-lthriftnb庫到您的make文件 – Dmitry 2013-04-13 15:58:56