MODBUS_API int modbus_set_response_timeout(modbus_t *ctx, uint32_t to_sec, uint32_t to_usec);
MODBUS_API int modbus_set_byte_timeout(modbus_t *ctx, uint32_t to_sec, uint32_t to_usec);
这在 mb2hal.c 中给出了这些编译错误:
hal/user_comps/mb2hal/mb2hal.c: In function ‘get_tx_connection’:
hal/user_comps/mb2hal/mb2hal.c:362:55: warning: passing argument 2 of ‘modbus_set_response_timeout’ makes integer from pointer without a cast [-Wint-conversion]
modbus_set_response_timeout(this_mb_link->modbus, &timeout);
^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:188:16: note: expected ‘uint32_t {aka unsigned int}’ but argument is of type ‘struct timeval *’
MODBUS_API int modbus_set_response_timeout(modbus_t *ctx, uint32_t to_sec, uint32_t to_usec);
^
hal/user_comps/mb2hal/mb2hal.c:362:5: error: too few arguments to function ‘modbus_set_response_timeout’
modbus_set_response_timeout(this_mb_link->modbus, &timeout);
^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:188:16: note: declared here
MODBUS_API int modbus_set_response_timeout(modbus_t *ctx, uint32_t to_sec, uint32_t to_usec);
^
hal/user_comps/mb2hal/mb2hal.c:369:51: warning: passing argument 2 of ‘modbus_set_byte_timeout’ makes integer from pointer without a cast [-Wint-conversion]
modbus_set_byte_timeout(this_mb_link->modbus, &timeout);
^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:191:16: note: expected ‘uint32_t {aka unsigned int}’ but argument is of type ‘struct timeval *’
MODBUS_API int modbus_set_byte_timeout(modbus_t *ctx, uint32_t to_sec, uint32_t to_usec);
^
hal/user_comps/mb2hal/mb2hal.c:369:5: error: too few arguments to function ‘modbus_set_byte_timeout’
modbus_set_byte_timeout(this_mb_link->modbus, &timeout);
^
In file included from hal/user_comps/mb2hal/mb2hal.h:18:0,
from hal/user_comps/mb2hal/mb2hal.c:27:
/usr/include/modbus/modbus.h:191:16: note: declared here
MODBUS_API int modbus_set_byte_timeout(modbus_t *ctx, uint32_t to_sec, uint32_t to_usec);
^
make: *** [Makefile:207: objects/hal/user_comps/mb2hal/mb2hal.o] Error 1
来自 <=3.0.x 的 modbus.h:
而 >= modbus 3.1.0 有:
这在 mb2hal.c 中给出了这些编译错误: