开源改变世界!!

由于 API 更改,针对 libmodbus 版本 3.1.0 或更高版本的编译失败 #105

推推 grbl 2年前 (2023-01-29) 121次浏览
关闭
hazelnusse 打开了这个问题 2016 年 7 月 4 日 · 0 条评论
关闭

由于 API 更改,针对 libmodbus 版本 3.1.0 或更高版本的编译失败#105

hazelnusse 打开了这个问题 2016 年 7 月 4 日 · 0 条评论

注释

由于 API 更改,针对 libmodbus 版本 3.1.0 或更高版本的编译失败 #105
贡献者
榛子酱 评论了 2016 年 7 月 4 日  

来自 <=3.0.x 的 modbus.h:

void modbus_set_response_timeout(modbus_t *ctx, const struct timeval *timeout);
void modbus_set_byte_timeout(modbus_t *ctx, const struct timeval *timeout);

而 >= modbus 3.1.0 有:

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
hazelnusse 添加了一个提交到 hazelnusse/linuxcnc 引用了这个问题 2016 年 7 月 5 日

喜欢 (0)