我正在尝试编译一段创建 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()'
我在安装 Thrift 时执行了此处列出的步骤。 http://thrift.apache.org/docs/install/os_x/
这是我的生成文件
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 $@
something_server: something_server.o $(GEN_OBJ)
$(CXX) $^ -o $@ -L/usr/local/lib -lthrift
something_client: something_client.o $(GEN_OBJ)
$(CXX) $^ -o $@ -L/usr/local/lib -lthrift
clean:
$(RM) *.o something_server something_client