gsoap例子的编译方法
2011-07-15 16:57:11| 分类: gSoap | 标签: |举报 |字号大中小 订阅
gsoap提供的例子在samples目录下,如果想编译的话,还得用点办法.
1、在linux下的编译方法
首先将gsoap解压后全部拷贝到linux的一个目录下,例如temp
注意切换到root用户
./configure --enable-samples
编译的情况见附1
这样每个例子就已经有makefile文件了
make
就会将gsoap编译成库,同时编译例子,但会碰到一个错误
g++ -DHAVE_CONFIG_H -I. -I…/…/… -I…/…/…/gsoap -I…/…/…/gsoap/plugin -DLINUX -DWITH_OPENSSL -DWITH_GZIP -DWSDL_IMPORT_PATH=“”/usr/local/share/gsoap/WS"" -g -O2 -MT autotest-soapC.o -MD -MP -MF .deps/autotest-soapC.Tpo -c -o autotest-soapC.o test -f 'soapC.cpp' || echo './'
soapC.cpp
In file included from soapH.h:13,
from soapC.cpp:16:
soapStub.h:99: error: integer constant is too large for “long” type
soapStub.h:99: error: integer constant is too large for “long” type
soapStub.h:99: error: integer constant is too large for “long” type
soapStub.h:105: warning: this decimal constant is unsigned only in ISO C90
soapStub.h:105: warning: this decimal constant is unsigned only in ISO C90
make[5]: *** [autotest-soapC.o] 错误1
这个是例子autotest的编译错误,估计是其中定义的常数超过了long表示的范围,我的系统中long估计为4个字节
但没有关系,因为gsoap库已经生成,而且其他例子我们可以直接到具体的例子目录下编译,例如mtom-stream执行make即可
如果想在界面中调试,可以使用eclipse
以下以mtom例子为例说明步骤
新建一个c的工程
gsoap例子的编译方法 - xzhoumin - MMZHOU的博客
注意路径选mtom的即可,这样工程就直接建在这个目录下
gsoap例子的编译方法 - xzhoumin - MMZHOU的博客
将gsoap目录下的stdgsoap2.c,h拷贝到mtom目录下,若是c++的工程就用stdgsoap2.cpp
当然也可以用库的方式,但若是要单步调试到stdsoap2中,库就不行了,还是建议用源代码。
修改编译选项,在编译前调用soapcpp工具,用于生成需要的代理等文件
命令用:
…/…/…/…/gsoap/src/soapcpp2 -cL -d… -I…/…/…/…/gsoap/import:…/…/…/…/gsoap …/mtom-test.h
如下图,在工程属性中修改,-d…参数表示将文件输出到上级目录,因此当前目录是Debug或Release
gsoap例子的编译方法 - xzhoumin - MMZHOU的博客
编译即可生成需要的文件
2、在windows下的编译方法
以vc2008为例,新建一个控制台的工程
在例子mtom-stream目录下创建工程
gsoap例子的编译方法 - xzhoumin - MMZHOU的博客
将其他文件从工程中删除,加入mtom-stream-test.c,h到文件中
将mtom-stream-test.c的右键属性中修改不需要预编译头文件,如下图:
gsoap例子的编译方法 - xzhoumin - MMZHOU的博客
在mtom-stream-test.h的右键属性中,修改自定义生成步骤,如下图
gsoap例子的编译方法 - xzhoumin - MMZHOU的博客
命令行为:
…\gsoap\bin\win32\soapcpp2 -cL -d…/… -I…/…/…/…/…/gsoap/import;…/…/…/…/…/gsoap $(InputPath)
输出随便输点东西
编译第一次后,会生成一些文件
将.c文件都加入到工程中,
将stdsoap2.c,h加入到工程中,再次编译就完成了
附1:
./configure --enable-samples
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /bin/mkdir -p
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking whether make sets $(MAKE)… (cached) yes
checking for g++… g++
checking for C++ compiler default output file name… a.out
checking whether the C++ compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C++ compiler… yes
checking whether g++ accepts -g… yes
checking for style of include used by make… GNU
checking dependency style of g++… gcc3
checking for gcc… gcc
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking dependency style of gcc… gcc3
checking whether gcc and cc understand -c and -o together… yes
checking for flex… flex
checking lex output file root… lex.yy
checking lex library… -lfl
checking whether yytext is a pointer… yes
checking for bison… bison -y
checking how to run the C preprocessor… gcc -E
checking for ranlib… ranlib
checking whether ln -s works… yes
checking for gawk… (cached) gawk
checking for a BSD-compatible install… /usr/bin/install -c
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /bin/grep -E
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking arpa/inet.h usability… yes
checking arpa/inet.h presence… yes
checking for arpa/inet.h… yes
checking xlocale.h usability… yes
checking xlocale.h presence… yes
checking for xlocale.h… yes
checking errno.h usability… yes
checking errno.h presence… yes
checking for errno.h… yes
checking fcntl.h usability… yes
checking fcntl.h presence… yes
checking for fcntl.h… yes
checking limits.h usability… yes
checking limits.h presence… yes
checking for limits.h… yes
checking netdb.h usability… yes
checking netdb.h presence… yes
checking for netdb.h… yes
checking netinet/in.h usability… yes
checking netinet/in.h presence… yes
checking for netinet/in.h… yes
checking for stdlib.h… (cached) yes
checking for string.h… (cached) yes
checking for strings.h… (cached) yes
checking for stdint.h… (cached) yes
checking sys/socket.h usability… yes
checking sys/socket.h presence… yes
checking for sys/socket.h… yes
checking for sys/types.h… (cached) yes
checking sys/time.h usability… yes
checking sys/time.h presence… yes
checking for sys/time.h… yes
checking sys/timeb.h usability… yes
checking sys/timeb.h presence… yes
checking for sys/timeb.h… yes
checking for unistd.h… (cached) yes
checking poll.h usability… yes
checking poll.h presence… yes
checking for poll.h… yes
checking openssl/ssl.h usability… yes
checking openssl/ssl.h presence… yes
checking for openssl/ssl.h… yes
checking gnutls/gnutls.h usability… no
checking gnutls/gnutls.h presence… no
checking for gnutls/gnutls.h… no
checking zlib.h usability… yes
checking zlib.h presence… yes
checking for zlib.h… yes
checking for an ANSI C-conforming const… yes
checking for size_t… yes
checking whether time.h and sys/time.h may both be included… yes
checking whether struct tm is in sys/time.h or time.h… time.h
checking for sys/time.h… (cached) yes
checking for unistd.h… (cached) yes
checking for alarm… yes
checking for working mktime… no
checking return type of signal handlers… void
checking for strftime… yes
checking for random… yes
checking for gettimeofday… yes
checking for ftime… yes
checking for localtime_r… yes
checking for timegm… yes
checking for gmtime… yes
checking for gmtime_r… yes
checking for memset… yes
checking for select… yes
checking for socket… yes
checking for snprintf… yes
checking for strchr… yes
checking for strerror… yes
checking for strerror_r… yes
checking for strrchr… yes
checking for strstr… yes
checking for strtol… yes
checking for strtoul… yes
checking for strtoll… yes
checking for strtoull… yes
checking for strtold… yes
checking for strtod… yes
checking for strtof… yes
checking for strtold_l… yes
checking for strtod_l… yes
checking for strtof_l… yes
checking for sscanf… yes
checking for sscanf_l… no
checking for sprintf_l… no
checking for wctomb… yes
checking for mbtowc… yes
checking for poll… yes
checking for isnan… yes
checking for isinf… yes
checking for gethostbyname_r… yes
checking for stdlib.h… (cached) yes
checking for GNU libc compatible malloc… yes
checking for disable namespaces in library… no
checking for enable ipv6 in library… no
checking for disable openssl in library… no
checking for enable gnutls in library… no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating gsoap.pc
config.status: creating gsoap++.pc
config.status: creating gsoapck.pc
config.status: creating gsoapck++.pc
config.status: creating gsoapssl.pc
config.status: creating gsoapssl++.pc
config.status: creating gsoap/Makefile
config.status: creating gsoap/src/Makefile
config.status: creating gsoap/wsdl/Makefile
config.status: creating gsoap/samples/Makefile
config.status: creating gsoap/samples/autotest/Makefile
config.status: creating gsoap/samples/calc/Makefile
config.status: creating gsoap/samples/calc++/Makefile
config.status: creating gsoap/samples/chaining++/Makefile
config.status: creating gsoap/samples/databinding/Makefile
config.status: creating gsoap/samples/dime/Makefile
config.status: creating gsoap/samples/dom/Makefile
config.status: creating gsoap/samples/oneway/Makefile
config.status: creating gsoap/samples/oneway++/Makefile
config.status: creating gsoap/samples/factory/Makefile
config.status: creating gsoap/samples/factorytest/Makefile
config.status: creating gsoap/samples/gmt/Makefile
config.status: creating gsoap/samples/googleapi/Makefile
config.status: creating gsoap/samples/hello/Makefile
config.status: creating gsoap/samples/httpcookies/Makefile
config.status: creating gsoap/samples/lu/Makefile
config.status: creating gsoap/samples/magic/Makefile
config.status: creating gsoap/samples/mashup/Makefile
config.status: creating gsoap/samples/mashup++/Makefile
config.status: creating gsoap/samples/mtom/Makefile
config.status: creating gsoap/samples/mtom-stream/Makefile
config.status: creating gsoap/samples/polytest/Makefile
config.status: creating gsoap/samples/primes/Makefile
config.status: creating gsoap/samples/roll/Makefile
config.status: creating gsoap/samples/router/Makefile
config.status: creating gsoap/samples/rss/Makefile
config.status: creating gsoap/samples/ssl/Makefile
config.status: creating gsoap/samples/template/Makefile
config.status: creating gsoap/samples/udp/Makefile
config.status: creating gsoap/samples/varparam/Makefile
config.status: creating gsoap/samples/wsa/Makefile
config.status: creating gsoap/samples/wsrm/Makefile
config.status: creating gsoap/samples/wsse/Makefile
config.status: creating gsoap/samples/xml-rpc-json/Makefile
config.status: creating config.h
config.status: executing depfiles commands