I wrote a soap-client with gsoap++ library. once i compiled this one as a stand-alone test app it was compiled fine, but when i try to compile these classes including in my project i get a lot of linking errors:
../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_ente开发者_运维知识库r(soap*, char const*, void*, int, unsigned int, char const*, char const*)':
and so on. In Codeblocks it linking fined... Here is my 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 $@
I linked against all necessary libraries (-lgsoapssl++ -lssl -lcrypto
) and I checked out requesting functions in these ones:
$ nm /usr/lib/libgsoapssl++.a | grep soap_begin_count
00018da0 T soap_begin_count
and there are in libraries. so, what a problem?
I believe you have to compile one of gSoap's stdsoap2.* files in your make. The generated soapC file depends on the core gSoap code.
One possible reason for this is the order that the libraries are specified to the linker, some linkers require that the libarary containing the definition of a function appears after the object or library that requires it. Try re-arranging the library definitions so that this is the case here and check your linkers documentaion to see if it requires this.
'stdsoap2.cpp' needs to be from the gsoap source directory.
PATH_TO_GSOAP_BUILD/gsoap-2.8/gsoap/stdsoap2.cpp (assuming gsoap-2.8)
精彩评论