PJSIP示例代码app_perror未在作用域中声明

PJSIP sample code app_perror was not declared in the scope

本文关键字:作用域 声明 perror 代码 app PJSIP      更新时间:2023-10-16

我正试图让PJSIP的示例代码正常工作,但在编译过程中我得到了错误:

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()属于哪个头。

感谢您的帮助。

此错误很可能来自另一个示例文件的复制/粘贴问题。我的意思是,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));
}