Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not compile when using std_msgs/Int8MultiArray #7

Open
MatCapLynx opened this issue Mar 4, 2022 · 1 comment
Open

Can not compile when using std_msgs/Int8MultiArray #7

MatCapLynx opened this issue Mar 4, 2022 · 1 comment

Comments

@MatCapLynx
Copy link

Hi,
I'm trying to use an array topic but I get the following error when compiling :

In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h: In member function 'virtual int std_msgs::MultiArrayLayout::deserialize(unsigned char*)':
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:60:123: error: 'void* realloc(void*, size_t)' moving an object of non-trivially copyable type 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'}; use 'new' and 'delete' instead [-Werror=class-memaccess]
         this->dim = (std_msgs::MultiArrayDimension*)realloc(this->dim, dim_lengthT * sizeof(std_msgs::MultiArrayDimension));
                                                                                                                           ^
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:8,
                 from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayDimension.h:12:9: note: 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} declared here
   class MultiArrayDimension : public ros::Msg
         ^~~~~~~~~~~~~~~~~~~
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:65:88: error: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
         memcpy( &(this->dim[i]), &(this->st_dim), sizeof(std_msgs::MultiArrayDimension));
                                                                                        ^
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:8,
                 from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayDimension.h:12:9: note: 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} declared here
   class MultiArrayDimension : public ros::Msg

There seems to be a problem with MultiArrayLayout.h causing the compilation of all arrays topics to fail. I've tried to modifiy it but I wasn't able to find the fix. Maybe it's a cpp compiler version issue.
I'm going to use another solution for now but it would be great if anyone knows how to fix this.

@NikiBob
Copy link

NikiBob commented Jan 30, 2023

Hi, I'm trying to use an array topic but I get the following error when compiling :

In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h: In member function 'virtual int std_msgs::MultiArrayLayout::deserialize(unsigned char*)':
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:60:123: error: 'void* realloc(void*, size_t)' moving an object of non-trivially copyable type 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'}; use 'new' and 'delete' instead [-Werror=class-memaccess]
         this->dim = (std_msgs::MultiArrayDimension*)realloc(this->dim, dim_lengthT * sizeof(std_msgs::MultiArrayDimension));
                                                                                                                           ^
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:8,
                 from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayDimension.h:12:9: note: 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} declared here
   class MultiArrayDimension : public ros::Msg
         ^~~~~~~~~~~~~~~~~~~
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:65:88: error: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
         memcpy( &(this->dim[i]), &(this->st_dim), sizeof(std_msgs::MultiArrayDimension));
                                                                                        ^
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:8,
                 from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayDimension.h:12:9: note: 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} declared here
   class MultiArrayDimension : public ros::Msg

There seems to be a problem with MultiArrayLayout.h causing the compilation of all arrays topics to fail. I've tried to modifiy it but I wasn't able to find the fix. Maybe it's a cpp compiler version issue. I'm going to use another solution for now but it would be great if anyone knows how to fix this.

I am facing the same issue. Did somebody find a solution for how to use any MultiArrays based on MultiArrayLayout.h in rosserial with ESP-IDF?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants