[asterisk-dev] Problems with custom C-file: undefined reference
Julian Fleischhauer
julian.fleischhauer at stud.uni-due.de
Mon Dec 5 16:53:36 CST 2016
Hey all,
I have a problem using a custom C-file. The error ouput received when
compiling is given below.
error output
.../system.c:1330: undefined reference to `XML_ParserCreate'
...
.../system.c:1465: undefined reference to `sip_get_header'
...
.../system.c:1608: undefined reference to `pcap_lookupnet'
...
Before, I had all code in chan_sip.c. I want to transfer the code into a
separate file (system.c) now. The dependencies given below MODULEINFO
are customly set and worked fine when used in chan_sip.c. Can anyone
figure out if something else has to be added somewhere? The code is
quoted below:
sip.h
const char *sip_get_header(const struct sip_request *req, const char
*name);
system.h
#include "asterisk/netsock2.h"
void ast_some_function(struct sip_pvt *p, struct ast_sockaddr *addr);
system.c
/*** MODULEINFO
<depend>sqlite3</depend>
<depend>expat</depend>
<depend>pcap</depend>
<support_level>extended</support_level>
***/
#include "asterisk/system.h"
#include "asterisk/sip.h"
void ast_some_function(struct sip_pvt *p, struct ast_sockaddr *addr)
{
xmlParser = XML_ParserCreate(NULL);
...
ast_copy_string(touser, sip_get_header(req, "To"),
strlen(sip_get_header(req, "To"))+1);
...
pcap_lookupnet(pcapDev, &netp, &maskp, errbuf);
}
chan_sip.c
#include "asterisk/system.h"
#include "asterisk/sip.h"
ast_some_function(p, addr);
Thank you for any help!
Regards,
Juliannn
More information about the asterisk-dev
mailing list