gsoap ++链接错误

时间:2011-06-14 07:43:08

标签: 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*)':

等等。在Codeblocks中它链接罚款...这是我的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

并且在图书馆中。那么,有什么问题?

3 个答案:

答案 0 :(得分:1)

可能的原因是为链接器指定了库的顺序,某些链接器要求包含函数定义的libarary出现在需要它的对象或库之后。尝试重新安排库定义,以便在此处进行测试,并检查您的链接器文档,看它是否需要它。

答案 1 :(得分:1)

我相信你必须在你的make中编译一个gSoap的stdsoap2。*文件。生成的soapC文件取决于核心gSoap代码。

答案 2 :(得分:1)

'stdsoap2.cpp'需要来自gsoap源目录。

PATH_TO_GSOAP_BUILD / gsoap-2.8 / gsoap / stdsoap2.cpp(假设gsoap-2.8)