[Spread-users] Undefined reference to functions error

Zahir Koradia zahir.koradia at gmail.com
Mon Aug 21 04:28:20 EDT 2006


Hi,
I am new to Spread and was trying to write a dummy program just to get
a feel of it.
I go the following error:
/cygdrive/c/DOCUME~1/Zahir/LOCALS~1/Temp/ccoIkCah.o:spread_sender.cc:(.text+0x67):
undefined reference to `_SP_connect'
/cygdrive/c/DOCUME~1/Zahir/LOCALS~1/Temp/ccoIkCah.o:spread_sender.cc:(.text+0xa8):
undefined reference to `_SP_join'
/cygdrive/c/DOCUME~1/Zahir/LOCALS~1/Temp/ccoIkCah.o:spread_sender.cc:(.text+0xf9):
undefined reference to `_SP_leave'
/cygdrive/c/DOCUME~1/Zahir/LOCALS~1/Temp/ccoIkCah.o:spread_sender.cc:(.text+0x106):
undefined reference to `_SP_disconnect'
collect2: ld returned 1 exit status

My header files are present in /usr/local/include. My code is present below:

// Program to basically test sending and receiving messages
// We will create two programs and have one send message to the other
// and the second one will send a message only on received a message
from teh first.
//this program will send a message on prompt.



#ifdef __cplusplus
extern "C"
{
#endif
#include <stdio.h>
#include <stdlib.h>
#include <sp.h>
int main()
{
  int ret;
  char priv_grp[MAX_GROUP_NAME];
  mailbox *sender_box;
  sender_box = (mailbox *)malloc(sizeof(mailbox));
  ret = SP_connect("4803 at localhost", "spread_sender", 0, 1,
sender_box, priv_grp);
  if(ret == ACCEPT_SESSION)
  {
    printf("Connect succeeded! Joining test_grp....\n");
  }
  else
  {
    printf("Connect failed!\n");
    return 0;
  }
  ret = SP_join(*sender_box, "test_grp");
  if(ret == 0)
  {
    printf("Join succeeded! Press any keey to send a message to the
group....\n");
    getchar();
  }
  else
  {
    printf("Join failed!\n");
    return 0;
  }



  SP_leave(*sender_box, "test_grp");
  SP_disconnect(*sender_box);
  return 0;
}

#ifdef __cplusplus
}
#endif


I have tried using g++ also but does not help. I have also tried using
a .c file with the same code but it dint work. I know this is not
directly related to spread but I would appreciate if someone helped me
out.

Thanks
Zahir koradia




More information about the Spread-users mailing list