自己使用Ubuntu18.04;
1、安装flex
下载地址: https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz
命令:
# sudo ./configure # sudo make # sudo make install2、安装bison
下载地址: ftp://ftp.gnu.org/gnu/bison/bison-2.7.tar.gz
命令:
# sudo ./configure # sudo make # sudo make install3、安装openssl
下载地址: https://www.openssl.org/source/old/1.0.2/openssl-1.0.2m.tar.gz
命令:
# sudo ./configure # sudo make # sudo make install4、安装gsoap
下载地址:https://sourceforge.net/projects/gsoap2/files/latest/download
命令:
# sudo ./configure --with-openssl=/usr/local/ssl # sudo make # sudo make install修改gsoap\typemap.dat文件,在文件末尾添加
wsnt__FilterType = $ wsnt__TopicExpressionType; _wsnt__NotificationMessageHolderType_Message = $_tt__Message* tt__Message;生成onvif.h文件
wsdl2h -c++ -x -t gsoap/typemap.dat -o onvif.h -d https://www.onvif.org/ver10/network/wsdl/remotediscovery.wsdl https://www.onvif.org/ver10/media/wsdl/media.wsdl http://www.onvif.org/onvif/ver20/imaging/wsdl/imaging.wsdl http://www.onvif.org/onvif/ver10/recording.wsdl http://www.onvif.org/onvif/ver10/search.wsdl http://www.onvif.org/onvif/ver10/replay.wsdl https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl http://www.onvif.org/onvif/ver20/ptz/wsdl/ptz.wsdl http://www.onvif.org/onvif/ver10/event/wsdl/event.wsdl生成onvif开发应用代码
$ mkdir onvif $ soapcpp2 -2 -C -c++ -x -j -I gsoap/import -I gsoap -I gsoap/custom -d onvif onvif.h
可能会遇到这样的错误:
wsa5.h(288): **ERROR**: service operation name clash: struct/class 'SOAP_ENV__Fault' already declared at wsa.h:273
解决方法:修改import\wsa5.h文件,将int SOAP_ENV__Fault修改为int SOAP_ENV__Fault_Alex
出现Compilation successful字样,编译成功完成.