1

I help some help to understand while my source don't compile, the main errors report are :

SerialC.nc:43: syntax error before `&'
SerialC.nc:43: warning: return-type defaults to `int'
SerialC.nc:43: conflicting types for `startList'

In my implementation I am working with an header file to define my struct and interfaces to be access in nesC file, one of my doubts is about struct! Can I define a struct like in C to run in nesC?

My code to header file:

typedef struct {
    float Knowledge_base[MAX_TAM];
    int control; 
}Temp;

void startList(Temp* knowledge_base);

void knowledge_base_control(Temp* knowledge_base, float temp_real);

My .c file :

void startList(Temp* knowledge_base){
    int i;
    knowledge_base->control=0;
    for (i=0; i<MAX_TAM; i++){
        knowledge_base[i]=0;
    }
};

Before all declarations and implementations I am trying use that in my nesC file, but I get some error in output.

My nesC file :

#include "ESA.h"

Temp knowledge_base_real;

startList(&knowledge_base_real);

1 Answers1

1

Function definition should look like this:

void startList(Temp* knowledge_base){
    int i;
    knowledge_base->control=0;
    for (i=0; i<MAX_TAM; i++){
        knowledge_base->Knowledge_base[i]=0; // changed here
    }
} // remove ; here

You need to access Knowledge_base array inside knowledge_base struct. Remove ; at the end of function definition.

Maciej
  • 9,355
  • 2
  • 15
  • 18
  • Mac, ok..thanks for your help, I modify my files, but I yet have the same errors :/ –  Jun 04 '15 at 20:57
  • The same output: In component `SerialC': SerialC.nc:43: syntax error before `&' SerialC.nc:43: warning: return-type defaults to `int' SerialC.nc:43: conflicting types for `startList' ESA.h:17: previous declaration of `startList' SerialC.nc:43: warning: data definition has no type or storage class –  Jun 04 '15 at 20:58
  • Try deleting `;` at the end of your function definition – Maciej Jun 04 '15 at 21:22
  • Mac, do you have some other ideia about it? :) –  Jun 05 '15 at 16:35
  • Hey Alezinha, I don't have nesC installed so I can't play around with it. I know that what you trying to do is possible. Some other poeple had similar problems. Maybe these links will help you. https://www.millennium.berkeley.edu/pipermail/tinyos-help/2011-January/049380.html and https://www.millennium.berkeley.edu/pipermail/tinyos-help/2010-October/048133.html – Maciej Jun 05 '15 at 19:52