mercredi 24 février 2016

Unable to compile a C file in Contiki

I am trying to write a code in contiki that allows motes to randomly generate values. Below is the code I tried:

#include "contiki.h"
#include "stdio.h" /* For printf() */
#include "stdlib.h"
PROCESS(random_process, "Random process");
AUTOSTART_PROCESSES(&random_process);
PROCESS_THREAD(random_process, ev, data)
{
PROCESS_BEGIN();
int r=rand();
printf("Hello, world. Random Number is %d",r);
PROCESS_END();
}

While generating the makefile I get the below error:

user@instant-contiki:~/Desktop/Random$ make target=native random_sample
TARGET not defined, using target 'native'
  CC        random_sample.c
  LD        random_sample.native
contiki-native.a(broadcast-annou): In function `set_timers':
/home/user/contiki-2.7/core/net/rime/broadcast-announcement.c:171: undefined reference to `random_rand'
collect2: ld returned 1 exit status
make: *** [random_sample.native] Error 1
rm random_sample.co

Can someone please help me with this? Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire