简体   繁体   English

osip库SIP错误

[英]osip library sip errors

On the How-To initialize libosip2 site theres program to initialize osip libraries https://www.gnu.org/software/osip/doc/html/group__howto0__initialize.html 在How-To初始化libosip2站点上,存在用于初始化osip库的程序https://www.gnu.org/software/osip/doc/html/group__howto0__initialize.html

#include <winsock2.h>
#include <Time.h>
#include <stdio.h>
#include <stdlib.h>
#include <osip2/osip.h>
#include <osipparser2/osip_parser.h>
#include <string.h>

int main()
{

    int i;
    osip_t *osip;
    i=osip_init(&osip);
    if (i!=0)

      return -1;
}

I'm trying to run this code but it doesnt work, library version 5.0.0 我正在尝试运行此代码,但它不起作用,库版本5.0.0

error: 错误:

||=== Build: Debug in cos2 (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `main':|
C:\Users\emergency\Documents\analizer\cos2\main.cpp|14|undefined reference to `osip_init'|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

In order to link with a library, you need to specify it on the command line. 为了与库链接,您需要在命令行上指定它。

Note that libosip2 produces two libraries and you have to link with both of them in order to use both parser (libosipparser2) and the sip engine (libosip2). 请注意, libosip2会生成两个库,您必须将它们都链接在一起才能同时使用解析器(libosipparser2)和sip引擎(libosip2)。

The exact command line depends on the platform, compiler you use and may also differ if you are linking to a static library or dynamic library. 确切的命令行取决于所使用的平台,编译器,并且如果链接到静态库或动态库,也可能会有所不同。

With GCC and dynamic linking, it should be that way: 使用GCC和动态链接时,应采用以下方式:

-L/install-directory-for-libosip2-libs/ -losipparser2 -losip2

-L/install-directory-for-libosip2-libs/ parameter refers to the directory where libraries are available. -L / install-directory-for-libosip2-libs /参数是指可使用库的目录。

这是因为您没有链接二进制osip.o

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM