modbus_master.cpp: In function ‘void* querySlaveDevices(void*)’: modbus_master.cpp:445:110: error: cannot convert ‘querySlaveDevices(void*)::st_men_data*’ to ‘st_mem_data*’ in assignment tempBuff = (struct st_men_data *)mmap(0,data_len,PROT_READ | PROT_WRITE, MAP_SHARED, fd,0); ^ modbus_master.cpp:445:40: note: class type ‘querySlaveDevices(void*)::st_men_data’ is incomplete tempBuff = (struct st_men_data *)mmap(0,data_len,PROT_READ | PROT_WRITE, MAP_SHARED, fd,0); ^~~~~~~~~~~ modbus_master.cpp:467:86: error: invalid types ‘unsigned int[int]’ for array subscript bool_input_buf[bool_input_index] = tempBuff->stInput[0][j]; ^ modbus_master.cpp:487:112: error: cannot convert ‘querySlaveDevices(void*)::st_men_data*’ to ‘st_mem_data*’ in assignment tempBuff = (struct st_men_data *)mmap(0, data_len,PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); ^ modbus_master.cpp:487:40: note: class type ‘querySlaveDevices(void*)::st_men_data’ is incomplete tempBuff = (struct st_men_data *)mmap(0, data_len,PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); ^~~~~~~~~~~ modbus_master.cpp:491:48: error: invalid types ‘unsigned int[int]’ for array subscript tempBuff->stOutput[0][j] = bool_output_buf[bool_output_index]; ^ 以上报错问题应该如何处理
时间: 2024-02-10 20:08:55 浏览: 195
master.zip_Qt:modbus_qt中master
这是一个编译错误,它提示了程序中的一些类型不匹配和未定义。其中,类类型 `querySlaveDevices(void*)::st_men_data` 未定义,导致无法进行类型转换。解决这个问题需要检查代码,确认 `st_men_data` 类型是否已经定义,并且检查变量名、数组下标等是否正确。同时,还需要检查是否包含了正确的头文件以及是否链接了必要的库文件。
阅读全文