PJSIP示例代码app_perror未在范围中声明

时间:2013-12-23 15:23:00

标签: c++ c compilation pjsip

我想让PJSIP的sample code起作用,但在编译期间我得到错误:

MXC061:~$ g++ -I /usr/local/include -L/usr/local/lib -o hello gst.cpp `pkg-config 
--cflags --libs libpjproject`
error: ‘app_perror’ was not declared in this scope
app_perror(THIS_FILE, "Unable to start UDP transport", status);

我知道我应该以某种方式包含库目录,但我甚至不知道 app_perror()属于哪个标题。

感谢任何帮助。

1 个答案:

答案 0 :(得分:2)

最有可能此错误来自另一个示例文件的复制/粘贴问题。我的意思是,app_perror在每个样本文件上定义,以根据测试运行以不同方式显示可能的错误,这是为了解决您的错误,您需要在开始时添加其定义,例如,在logging_on_rx_msg之前:

static void app_perror(const char *sender, const char *title, pj_status_t status)
{
    char errmsg[PJ_ERR_MSG_SIZE];

    pj_strerror(status, errmsg, sizeof(errmsg));
    PJ_LOG(1,(sender, "%s: %s", title, errmsg));
}