zoukankan      html  css  js  c++  java
  • Gsoap编译

    gSOAP编译工具提供了一个SOAP/XML 关于C/C++ 语言的实现,从而让C/C++语言开发web服务或客户端程序的工作变得轻松了很多。gSOAP支持大多数平台,包括嵌入式系统和小系统。 
    你首先要定义好c/s通讯的函数接口,通过这些函数接口gSOAP就可以生成server端和client端的框架。生成的客户端(服务端)内部API可以将接收到的xml反序列化成C/C++的数据结构,也可以将本地的C/C++的数据结构序列化成xml格式发送出去。而你只需要分别在server端和client端实现你定义的那些接口就行了。 
    gSOAP工具主要包括两个可执行文件:wsdl2h和soapcpp2。wsdl2h可以读取.wsdl格式文件并输出.h文件,而soapcpp2则可以读取.h格式文件(wsdl2h生成的或者包含用户自己定义的接口)生成server端和client端的框架。 
    gSOAP下载地址:https://sourceforge.net/projects/gsoap2/files/ 
    笔者下载的版本为2.8.44,解压以后可以在gsoap/bin文件夹发现有 macosx 和 win32 两个平台的已经编译好的可以执行文件。没有linux平台的。gSOAP生成server端和client端的框架是可以平台使用的,所以如果你完全可以在windows平台上生成你需要的C/C++代码并将其拷贝到其他操作系统操作平台使用。 
    下面来生成linux平台的wsdl2h和soapcpp2可执行文件。 
    我的编译环境为ubuntu 16.04 64位。g++ 4.8.5 gcc 4.8.5 
    1. cd 到你解压出来的文件夹根目录。

    test@test-virtual-machine:~/Downloads/gsoap-2.8$ pwd
    /home/test/Downloads/gsoap-2.8
    • 1
    • 2
    1. 因为我不想安装gsoap到系统内,只想要编译生成的可执行文件,所以我在将安装目录设置为一个非系统目录(例如我自己创建的文件夹gsoap/my_bin)。
    ~/Downloads/gsoap-2.8$ ./configure --prefix=gsoap/my_bin
    • 1

    –prefix 参数可以指定你的安装目录。 
    3.执行 make 
    错误1.

    s/c$/h/` y.output soapcpp2_yacc.output -- yacc -d -v 
    ../../ylwrap: line 176: yacc: command not found
    Makefile:521: recipe for target 'soapcpp2_yacc.c' failed
    • 1
    • 2
    • 3

    编译出错 : yacc: 未找到命令 , 需要安装yacc

    $sudo apt-get install bison
    • 1

    错误2. 
    /bin/bash ../../ylwrap soapcpp2_lex.l .c soapcpp2_lex.c -- /bin/bash /home/test/Downloads/gsoap-2.8/missing flex 
    updating lex.yysoapcpp2_lex.c 

    编译出错 : flex: 未找到命令 , 需要安装flex

    sudo apt-get install flex
    • 1

    还可能安装openssl

    sudo apt-get install openssl
    • 1

    还有openssl的库文件

    sudo apt-get install libssl-dev
    • 1

    最后执行

    sudo make install
    • 1

    安装成功。 
    这里写图片描述

    安装到可执行文件到我指定的文件夹 
    这里写图片描述

    转自:https://blog.csdn.net/u010293286/article/details/70182962

    参考文章链接:http://www.cnblogs.com/coveted/p/3492342.html

    linux-i386(ubuntu)下编译安装gsoap_2.8.17过程记录


    过程记录 : 


    1.下载gsoap_2.8.17.zip 并 解压 : $unzip gsoap_2.8.17.zip
     
     
    2.进入解压后的目录gsoap-2.8

     
    3.自动配置编译环境:  $./configure –prefix=$(pwd)/_install 
     
    配置失败
    • 原因:error: C++ compiler cannot create executables
    • 解决办法:You need to install c++ on your computer. even if you installed gcc that doesn’t automatically install g++. Try to run one of the following commands that fit your Linux distribution best :)
    • yum install gcc-c++ or apt-get install gcc-c++ . if apt-get doesn’t like the command try :apt-get install g++
    安装c++编译器 : $sudo apt-get install g++

    重新执行配置命令,成功!

    4.编译安装 : $sudo make

     
    编译出错 : yacc: 未找到命令 , 需要安装yacc
    yacc和lex在ubuntu使用flex和bison代替,此处安装bison就是安装yacc
    执行命令 : $sudo apt-get install bison

    安装完成后继续编译,结果出错:

    很明显,需要安装flex : sudo apt-get install flex

    继续编译,继续出错 :

    原因:缺少openssl,安装openssl : suod apt-get install openssl

    网上还说要安装openssl的库文件 : sudo apt-get install libssl-dev

    出错 
    sudo apt-get install libgtk2.0-dev libglib2.0-dev
    编译成功!

    5.安装  sudo make install

     
    总结 : 
              1.安装编译工具 : $sudo apt-get install g++ 或者 $sudo apt-get install build-essential
              2.可能需要安装GTK+和Glib库 : $sudo apt-get install libgtk2.0-dev libglib2.0-dev
              3.安装flex和bison代替lex和yacc :  $sudo apt-get install flex bison
              4.安装openssl      :   $sudo apt-get install openssl
                                            $sudo apt-get install libssl-dev
              5.不能有中文路径
     
     
  • 相关阅读:
    numpy 支持切片取值,使用ix_ 也可以取到
    pyinstaller 打包文件成 exe
    matplotlib 直方图概率不为1
    小提琴图 ValueError: object arrays are not supported
    pip 生成 requirements.txt
    CF1515E(连续段 dp)
    Lg7 月赛(构造,树形 dp)
    [省选联考 2020 A 卷] 组合数问题 题解报告
    愤怒的小 N 题解报告
    CF32E 题解
  • 原文地址:https://www.cnblogs.com/liushui-sky/p/9304468.html
Copyright © 2011-2022 走看看