Curl_easy_getinfo符号错误
curl_easy_getinfo undefined symbol error
我使用星号13.5.0版本。在utils目录中,我创建了一个名为curl_util的新模块,其源代码如下:
#include "asterisk/curl_utils.h"
HttpResponse * httpResponseNew()
{
HttpResponse * response = calloc(1, sizeof(HttpResponse));
return response;
error:
return NULL;
}
HttpResponse * httpRequestPost(char *url, char *post_body, size_t size)
{
struct MemoryStruct chunk;
CURL *curl = curl_easy_init();
chunk.memory = malloc(1);
chunk.size = 0;
HttpResponse *response = httpResponseNew();
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 0);
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post_body);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, size);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HttpResponseMemoryWriter);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
response->res = curl_easy_perform(curl);
if (response->res != CURLE_OK)
{
response->OK = 0;
}
else
{
response->OK = 1;
response->size = chunk.size;
response->body = chunk.memory;
}
curl_easy_cleanup(curl);
return response;
error:
free(chunk.memory);
if (curl) curl_easy_cleanup(curl);
return response;
}
在chan_sip.c中,我调用上面提到的httpRequestPost函数。执行make和make install是可以的。但是,当启动dahdi和星号时,我得到了以下错误:
加载模块chan_sip错误。http prequestpost
loader.c: module chan_sip. c因此无法加载
你能给点提示或建议来修复这个错误吗?
不需要编辑makefile。您只需要使用ASTLDFLAGS编译器选项,如:
./configure
make ASTLDFLAGS="-lcurl"
make install
make samples
make config
我通过以下操作修复了这个错误:
删除libcurl4-openssl-dev
从http://curl.haxx.se/下载CURL,解压缩,运行命令。/configure, make, make install
编辑星号的Makefile,为编译标记添加-lcurl
相关文章:
- 在C++中使用内联方法时出现未定义的符号错误
- 我收到错误LNK2001:未解析的外部符号(C++代码)
- 错误:隐式转换更改符号:'int'到'unsigned long'
- 错误:当我从"WinDbg"打开可执行文件时,找不到符号文件。默认导出 ntdll 的符号.dll
- 可视抽象类 c++(错误 LNK 2001:未解析的外部符号)
- clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) - 体系结构的未定义符号 x86_64:
- 添加符号 libgtest.so 错误:命令行中缺少 DSO
- 如何摆脱C++中未解析的外部符号"private: static char"错误?
- 当 lib 已添加到其他依赖项时,如何在 VS 中调试未解析的外部符号错误
- 体系结构x86_64的未定义符号:链接器错误
- 错误LNK2019未解析的外部符号"public: __thiscall SLinkList<char>::SLinkList<char>(void)"
- 引入参数化构造函数后显示 LNK 2019 未解析外部符号的代码错误
- 与Qt交叉编译到Raspberry Pi 3B+通讯录(协议缓冲区)-错误符号查找错误
- 链接错误:符号重复
- 架构X86_64静态类成员的错误符号X86_64错误
- 缓冲区中使用 GetWindowText 的错误符号
- OSX:ld:警告:错误符号操作:适用于核心库
- 为什么 Folly 的共享库引用了 Boost 中的错误符号?(OS X 上的 GCC)
- 嵌入lua运行时错误:符号未找到:_luaL_newstate
- C++ 找不到"::"架构的苹果马赫-O链接器错误/符号