2017-01-11 91 views
0
What are these errors ? 

/home/pi/try/client/c/libs/kaa/src/kaa/gen/kaa_logging_gen.c:93:9: error: too many arguments to function ‘avro_binary_encoding.read_char’ 
     avro_binary_encoding.read_char(reader, &record->NodeId); 
     ^
/home/pi/try/client/c/libs/kaa/src/kaa/gen/kaa_logging_gen.c:95:2: error: too many arguments to function ‘avro_binary_encoding.read_char’ 
    avro_binary_encoding.read_char(reader, &record->OnlineStat); 
^
/home/pi/try/client/c/libs/kaa/src/kaa/gen/kaa_logging_gen.c:99:2: error: too many arguments to function ‘avro_binary_encoding.read_char’ 
    avro_binary_encoding.read_char(reader, &record->FirmwareVER); 

以前我得到錯誤,他們說read_char和write_char沒有聲明爲函數。但聲明函數後,我仍然有錯誤。但是這個功能是我們不知道該怎麼做的。這些錯誤是什麼? (avro)

我們爲write_char和read_char做的是:

static int read_char(avro_reader_t reader) 
{ 
    /* 
    * no-op 
    */ 
    AVRO_UNUSED(reader); 

    return 3; 
} 

static int write_char(avro_writer_t writer) 
{ 
    /* 
    * no-op 
    */ 
    AVRO_UNUSED(writer); 

    return 3; 
} 

以下是其他功能的其他例子:

static int read_string(avro_reader_t reader, char **s, int64_t *len) 
{ 
    (void)len; 
    int64_t str_len = 0; 
    int rval; 
    check_prefix(rval, read_long(reader, &str_len), 
      "Cannot read string length: "); 
    *s = (char *) KAA_MALLOC(str_len + 1); 
    if (!*s) { 
     return ENOMEM; 
    } 
    (*s)[str_len] = '\0'; 
    AVRO_READ(reader, *s, str_len); 
    return 0; 
} 

static int write_string(avro_writer_t writer, const char *s) 
{ 
    int64_t len = strlen(s); 
    return write_bytes(writer, s, len); 
} 
+0

它看起來像'read_char'和'write_char'應該有兩個參數,但你已經定義了它們只有一個? –

+0

但我不太確定什麼是2個參數或參數我應該把... –

回答

1

好像你已經過去了兩個參數與一個參數

定義函數
static int read_char(avro_reader_t reader) 
static int write_char(avro_writer_t writer) 

每個都有一個參數 但y ou叫他們使用

avro_binary_encoding.read_char(reader, &record->NodeId); 
avro_binary_encoding.read_char(reader, &record->OnlineStat); 
avro_binary_encoding.read_char(reader, &record->FirmwareVER); 

其中傳遞2個參數。

+0

所以我沒有添加記錄的參數?我會試試看..謝謝.. –