Link error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What's the command-line when you compile? Are you compiling with -Wall
and -Werror?

Grepping through my include/ and lib/ directories for pjproject-1.3, I
can't find a function in any header file or object in any of the
libraries called pjsua_invite - if you compiled without -Werror, the
compiler probably only spat out a warning of an implicit declaration
and left the error for the linker to find. Try recompiling with
-Werror or just search for warnings to this effect.

I've not used past versions of this library - could this be a function
you're using from an old API?

John G


On Thu, Sep 10, 2009 at 4:16 PM, Rachel Baskaran
<rachelbaskaran at gmail.com> wrote:
> The script I run:( I highlighted the command where it shows the error )
>
> #include <pjsua-lib/pjsua.h>
> #include "getopt.h"
> #include <stdlib.h>
>
>
> #define THIS_FILE "rach.c"
>
> #define SIP_DOMAIN "example.com"
> #define SIP_USER?? "rachel"
> #define SIP_PASSWD "secret"
>
>
>
>
> static pjsip_inv_session *inv_session;
>
>
> /* Notify UI when invite state has changed */
>
> void pjsua_ui_inv_on_state_changed(pjsip_inv_session *inv, pjsip_event *e)
> {
> const char *state_names[] =
> {
> "NULL", "CALLING",
> "INCOMING","EARLY","CONNECTING","CONFIRMED","DISCONNECTED","TERMINATED"};
>
> PJ_UNUSED_ARG(e);
>
> PJ_LOG(3,(THIS_FILE, "Invite session state changed to %s",
> state_names[inv->state]));
>
> if(inv->state == PJSIP_INV_STATE_DISCONNECTED) {
>
> if(inv == inv_session)
> inv_session = NULL;
> }
> else
> {
> inv_session = inv;
> }
> }
>
>
> static void ui_help(void)
> {
> puts("");
> puts("Console keys:");
> puts("m? Make a call/another call");
> puts("a Answer incoming call");
> puts("h Hangup current call");
> puts("q Quit");
> puts("");
> fflush(stdout);
> }
>
> static pj_bool_t input(const char *title,char *buf, pj_size_t len)
> {
> char *p;
>
> printf("%s (empty to cancel):", title);
> fflush(stdout);
> fgets(buf, len, stdin);
>
> /* Remove newlines */
> for(p=buf; ;++p)
> {
> if(*p =='\r' || *p =='\n') *p='\0';
> else if(!*p)
> break;
> }
>
> if(!*buf)
> return PJ_FALSE;
> return PJ_TRUE;
> }
>
>
>
>
> static void error_exit(const char *title, pj_status_t status)
> {
> pjsua_perror(THIS_FILE, title, status);
> pjsua_destroy();
> exit(1);
> }
>
>
>
>
>
> static void ui_console_main(void)
> {
> char buf[128];
> pjsip_inv_session *inv;
>
>
> //ui_help();
>
> for(;;)
> {
>
> ui_help();
> fgets(buf, sizeof(buf), stdin);
>
> switch (buf[0]) {
>
> case 'm':
> if(inv_session != NULL) {
> puts("Can not make call while another one is in progress");
> fflush(stdout);
> continue;
> }
>
> #if 1
>
> ?? /* Make call!: */
> if(!input("Enter URL to call", buf, sizeof(buf)))
> continue;
>
> pjsua_invite(buf, &inv);
>
> #else
>
> pjsua_invite("sip:localhost:5061", &inv);
>
> #endif
>
> ??? break;
>
>
>
> case 'a':
>
> if(inv_session == NULL || inv_session->role != PJSIP_ROLE_UAS ||
> inv_session->state >= PJSIP_INV_STATE_CONNECTING)
> {
> puts("No pending incoming call");
> fflush(stdout);
> continue;
> }
>
> else
> {
> pj_status_t status;
> pjsip_tx_data *tdata;
>
> if(!input("Answer with code (100-699)", buf, sizeof(buf)))
> continue;
>
>
>
> status = pjsip_inv_answer(inv_session, atoi(buf) ,NULL,NULL, &tdata);
> if(status == PJ_SUCCESS)
> status = pjsip_inv_send_msg(inv_session, tdata);
>
> if(status != PJ_SUCCESS)
> error_exit("Unable to create/send response", status);
> }
>
> break;
>
> case 'h':
>
> if(inv_session == NULL) {
> puts("No current call");
> fflush(stdout);
> continue;
> }
> else
> {
>
> pj_status_t status;
> pjsip_tx_data *tdata;
>
>
> status = pjsip_inv_end_session(inv_session, PJSIP_SC_DECLINE, NULL, &tdata);
> if(status != PJ_SUCCESS) {
> error_exit("Failed to create end session message", status);
> continue;
> }
>
> status = pjsip_inv_send_msg(inv_session, tdata);
> if(status != PJ_SUCCESS) {
> error_exit("Failed to send end session message", status);
> continue;
> }
> }
>
> break;
>
> case 'q':
> goto on_exit;
> }
> }
> on_exit:
> ;
>
> All I want my script to do is call the specified URL in else part( when they
> run the script ) or when I press 'm' call the URL I enter. This just the
> part of code. It registers to example.com( since it's test after few mins it
> says timeout )
>
> The only line on my shell prompt is:
> output/rach-i686-pc-mingw32/rach.o:rach.c(.text+0x4cf): Undefined reference
> to 'pjsua_invite'.
>
> All I did when I downloaded the source from pjsip.org, is installed GNU
> compiler( Mingw, msys ) and in shell prompt gave the below command:
> cd C:/pjproject-1.3
> ./configure
> ./make dep && make clean && make
>
> To run the pjsua:
> cd pjproject-1.3/pjsip-apps/bin
> ./pjsua-i686-pc-mingw32
> and that ran the pjsua_app.
>
> Since I need a script to suit my requirement I went to write my own.
>
> It would be great if you'll help me out.
>
> Thanks!
>
>
>
> On Thu, Sep 10, 2009 at 10:55 AM, John Graham
> <johngavingraham at googlemail.com> wrote:
>>
>> Can you post some more information? A copy & paste of (1) the command
>> you run that generates the error, (2) the last, say, 50 lines of
>> output (more if you think it'll help) will help greatly! ?Also, what
>> architecture are you building on? Are you cross-compiling?
>>
>> John G
>>
>>
>>
>> On Thu, Sep 10, 2009 at 3:44 PM, Rachel Baskaran
>> <rachelbaskaran at gmail.com> wrote:
>> > Hey,
>> >
>> > I think this below error is a link error:
>> >
>> > Undefined reference to 'pjsua_invite'.
>> >
>> > I run pjproject-1.3? with GNU compiler. I checked all the libraries, but
>> > still I get this error.
>> >
>> > How to solve it?
>> >
>> > Any help!
>> >
>> > Thanks!
>> >
>> > _______________________________________________
>> > Visit our blog: http://blog.pjsip.org
>> >
>> > pjsip mailing list
>> > pjsip at lists.pjsip.org
>> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>> >
>> >
>>
>> _______________________________________________
>> Visit our blog: http://blog.pjsip.org
>>
>> pjsip mailing list
>> pjsip at lists.pjsip.org
>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux