linux-gsoap链接错误

我用gsoap库编写了一个soap-client.一旦我将此程序编译为独立的测试应用程序,它就可以正常编译,但是当我尝试编译这些类(包括在我的项目中)时,我会遇到很多链接错误:

../common/UserGausClient/UserGausClient.o: In function `GAUS::SSLInit()':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/UserGausClient.h:11: undefined reference to `soap_ssl_init'
../common/UserGausClient/soapC.o: In function `soap_faultdetail':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:117: undefined reference to `soap_malloc'
../common/UserGausClient/soapC.o: In function `soap_getelement':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:152: undefined reference to `soap_peek_element'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:154: undefined reference to `soap_lookup_type'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:155: undefined reference to `soap_lookup_type'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:215: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:219: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:223: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:227: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:231: undefined reference to `soap_match_tag'
../common/UserGausClient/soapC.o:/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:235: more undefined references to `soap_match_tag' follow
../common/UserGausClient/soapC.o: In function `soap_ignore_element(soap*)':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:333: undefined reference to `soap_peek_element'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:337: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:354: undefined reference to `soap_element_end_in'
../common/UserGausClient/soapC.o: In function `soap_class_id_enter(soap*, char const*, void*, int, unsigned int, char const*, char const*)':

等等.在代码块中,链接被罚款…这是我的Makefile:

CC=g++
RM=rm
CFLAGS=-c -g -Wall -DWITH_OPENSSL
LDFLAGS=-lpcrecpp -lpq -lcryptopp -lprotobuf -lrt -lgsoapssl++ -lssl -lcrypto -L/usr/lib/ -L/usr/local/lib/ -lgsoap

SOURCES=../common/PgConnectionManager.cpp \
    ../common/RSADecryptor.cpp \
    ../common/RSAEncryptor.cpp \
    ../common/RSAKeyGenerator.cpp \
    ../common/RSAKeyLoaderBase.cpp \
    ../common/RSAManager.cpp \
    ../common/TcpServer.cpp \
    ../common/UserGausClient/UserGausClient.cpp \
    ../common/UserGausClient/soapC.cpp \
    ../common/UserGausClient/soapuserBindingProxy.cpp \
    ../proto/BalanceHistory.pb.cc \
    ../proto/Bio.pb.cc \
    ../proto/ClientRegistration.pb.cc \
    ../proto/EmployeePermissions.pb.cc \
    ../proto/OperatorAuthentication.pb.cc \
    ../proto/Passport.pb.cc \
    ../proto/Ping.pb.cc \
    ../proto/SearchForBill.pb.cc \
    ../proto/UpdateClientData.pb.cc \
    RequestDispatcher.cpp \
    SQLStorage.cpp \
    SessionManager.cpp \
    main.cpp \


OBJECTS_SEARCHER=$(SOURCES:.cpp=.o)
OBJECTS=$(OBJECTS_SEARCHER:.cc=.o)

SEARCHER=registrator
INCLUDE=-I ../ 

all: $(SEARCHER) 

$(SEARCHER): $(OBJECTS)
    $(CC) $(LDFLAGS) $(OBJECTS) -o $@
clean:
    $(RM) -f $(OBJECTS)

.cpp.o:
    $(CC) $(CFLAGS) $(INCLUDE) $< -o $@

我链接了所有必需的库(-lgsoapssl -lssl -lcrypto),并检查了其中的请求功能:

$nm /usr/lib/libgsoapssl++.a | grep soap_begin_count
00018da0 T soap_begin_count

并且有图书馆.那么,什么问题呢?

解决方法:

我相信您必须在自己的make中编译gSoap的stdsoap2.*文件之一.生成的soapC文件取决于核心gSoap代码.

上一篇:Ubuntu20.04上使用gsoap2.8


下一篇:gsoap开发webservice 服务端.md