Modbus Code lässt sich nicht compilieren

Gast #5118367
Lesenswert?

Hab hier Code für den Raspberry Pi mit dem ich nicht zurecht komme.

In modbus.h:
1
MODBUS_API int modbus_get_response_timeout(modbus_t *ctx, uint32_t *to_sec, uint32_t *to_usec);


In modbus.c
1
/* Get the timeout interval used to wait for a response */
2
int modbus_get_response_timeout(modbus_t *ctx, uint32_t *to_sec, uint32_t *to_usec)
3
{
4
    if (ctx == NULL) {
5
        errno = EINVAL;
6
        return -1;
7
    }
8

9
    *to_sec = ctx->response_timeout.tv_sec;
10
    *to_usec = ctx->response_timeout.tv_usec;
11
    return 0;
12
}


In main von test.c:
1
modbus_t *ctx = NULL;
2
uint32_t sec_to = 1;
3
uint32_t usec_to = 0;
4
modbus_get_response_timeout(ctx, &sec_to, &usec_to);

gcc -Wall -I /usr/include/modbus -lmodbus -o test test.c
Ergebnis:
test.c:42:5: error: too many arguments to function 
‘modbus_get_response_timeout’

Könnte es sein, daß der Compiler noch etwas benötigt?

Für mich liegt hier erstmal kein Fehler vor. Hat das Ganze etwas mit dem 
Wort 'MODBUS_API' zu tun das vor dem Rückgabewert der Funktion im Header 
File steht? Und was ist überhaupt der Zweck eines Wortes vor dem 
Rückgabewert im Prototyp?

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren