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

compilation fails with cmake #1

Open
altineller opened this issue Jul 12, 2019 · 2 comments
Open

compilation fails with cmake #1

altineller opened this issue Jul 12, 2019 · 2 comments

Comments

@altineller
Copy link

Hello,

In file talker.cpp 2 include directives are mistyped:

#include <AK8963AK8963_Magnetometer.h>
#include <AK8963AK8963_Magnetometer.cpp>

There is an extra AK8963 before the _Mag... after fixing those I got the following error:

[ 66%] Building CXX object ros-mpu9250-imu/CMakeFiles/imuout.dir/src/talker.cpp.o In file included from /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/src/talker.cpp:4:0: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/AK8963_Magnetometer.h:41:23: error: ISO C++ forbids declaration of ‘lsm303DLHCMagData_s’ with no type [-fpermissive] lsm303DLHCMagData_s() : x(0), y(0), z(0) {} ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/AK8963_Magnetometer.h: In member function ‘int AK8963_MagData_s::lsm303DLHCMagData_s()’: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/AK8963_Magnetometer.h:41:27: error: only constructors take member initializers lsm303DLHCMagData_s() : x(0), y(0), z(0) {} ^ In file included from /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/src/talker.cpp:5:0: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/MPU9250_Acc_Gyro.h: In constructor ‘MPU9250AccelData_s::MPU9250AccelData_s()’: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/MPU9250_Acc_Gyro.h:48:5: error: class ‘MPU9250AccelData_s’ does not have any field named ‘gir_x’ : gir_x(0), gir_y(0), gir_z(0), acc_x(0), acc_y(0), acc_z(0) {} ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/MPU9250_Acc_Gyro.h:48:15: error: class ‘MPU9250AccelData_s’ does not have any field named ‘gir_y’ : gir_x(0), gir_y(0), gir_z(0), acc_x(0), acc_y(0), acc_z(0) {} ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/MPU9250_Acc_Gyro.h:48:25: error: class ‘MPU9250AccelData_s’ does not have any field named ‘gir_z’ : gir_x(0), gir_y(0), gir_z(0), acc_x(0), acc_y(0), acc_z(0) {} ^ In file included from /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/src/talker.cpp:7:0: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/MPU9250_Acc_Gyro.cpp: In member function ‘void MPU9250_Acc_Gyro::begin()’: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/MPU9250_Acc_Gyro.cpp:18:43: error: ‘writeByte’ was not declared in this scope writeByte(MPU9250_ADDRESS, CONFIG, 0x03); ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/MPU9250_Acc_Gyro.cpp: In member function ‘void MPU9250_Acc_Gyro::read()’: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/MPU9250_Acc_Gyro.cpp:56:15: error: ‘INT_STATUS’ was not declared in this scope if(readByte(INT_STATUS) & 0x01) { // wait for magnetometer data ready bit to be set ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/MPU9250_Acc_Gyro.cpp:56:25: error: ‘readByte’ was not declared in this scope if(readByte(INT_STATUS) & 0x01) { // wait for magnetometer data ready bit to be set ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/MPU9250_Acc_Gyro.cpp:57:55: error: ‘readBlock’ was not declared in this scope readBlock(ACCEL_XOUT_H, sizeof(block_Acc), block_Acc); // Read the six raw data and ST2 registers sequentially into data array ^ In file included from /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/src/talker.cpp:8:0: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/I2CBus.cpp: In member function ‘void I2CBus::addressSet(uint8_t)’: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/I2CBus.cpp:22:46: error: ‘ioctl’ was not declared in this scope int result = ioctl(fd, I2C_SLAVE, address); ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/I2CBus.cpp: In member function ‘void I2CBus::writeByte(uint8_t, uint8_t)’: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/I2CBus.cpp:31:61: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope int result = i2c_smbus_write_byte_data(fd, command, data); ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/I2CBus.cpp: In member function ‘uint8_t I2CBus::readByte(uint8_t)’: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/I2CBus.cpp:40:54: error: ‘i2c_smbus_read_byte_data’ was not declared in this scope int result = i2c_smbus_read_byte_data(fd, command); ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/I2CBus.cpp: In member function ‘int I2CBus::tryReadByte(uint8_t)’: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/I2CBus.cpp:50:48: error: ‘i2c_smbus_read_byte_data’ was not declared in this scope return i2c_smbus_read_byte_data(fd, command); ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/I2CBus.cpp: In member function ‘void I2CBus::readBlock(uint8_t, uint8_t, uint8_t*)’: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/include/I2CBus.cpp:55:71: error: ‘i2c_smbus_read_i2c_block_data’ was not declared in this scope int result = i2c_smbus_read_i2c_block_data(fd, command, size, data); ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/src/talker.cpp: In function ‘int main(int, char**)’: /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/src/talker.cpp:53:5: error: ‘roll’ was not declared in this scope roll = (float)atan2(acc_gyro.raw.acc_y, acc_gyro.raw.acc_z); ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/src/talker.cpp:62:6: error: ‘else’ without a previous ‘if’ }else{ ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/src/talker.cpp:63:7: error: ‘pitch’ was not declared in this scope pitch = (float)atan(-acc_gyro.raw.acc_x / (acc_gyro.raw.acc_y * sin(roll) + acc_gyro.raw.acc_z * cos(roll))); ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/src/talker.cpp:66:25: error: ‘pitch’ was not declared in this scope imu.orientation.y = pitch; ^ /home/ubuntu/catkin_ws/src/ros-mpu9250-imu/src/talker.cpp:68:5: error: ‘yaw’ was not declared in this scope yaw = (float)atan2(mag.raw.z * sin(roll) - mag.raw.y * cos(roll), mag.raw.x * cos(pitch) + mag.raw.y * sin(pitch) * sin(roll) + mag.raw.z * sin(pitch) * cos(roll)); ^ ros-mpu9250-imu/CMakeFiles/imuout.dir/build.make:62: recipe for target 'ros-mpu9250-imu/CMakeFiles/imuout.dir/src/talker.cpp.o' failed make[2]: *** [ros-mpu9250-imu/CMakeFiles/imuout.dir/src/talker.cpp.o] Error 1 CMakeFiles/Makefile2:449: recipe for target 'ros-mpu9250-imu/CMakeFiles/imuout.dir/all' failed make[1]: *** [ros-mpu9250-imu/CMakeFiles/imuout.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j2" failed

any ideas / recomendations or help greatly appreciated.

best regards,
C.

@MoffKalast
Copy link

Yeah, same issue. I'm not entirely sure how this thing ever worked, even the package.xml is missing an obligatory license tag.

@robert-meiner
Copy link

This is fixed in the code here

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

3 participants