openxrlab / xrslam

OpenXRLab Visual-inertial SLAM Toolbox and Benchmark
Apache License 2.0
455 stars 55 forks source link

error: too few arguments to function ‘int XRSLAMCreate #49

Closed cmakelabs closed 3 months ago

cmakelabs commented 3 months ago

Hello, I am very interested in trying out XRSLAM, while building for ROS, I got this error, and how to resolve this issue

/home/noetic/xrslam/xrslam-ros/src/xrslam-ros/src/xrslam_node.cpp: In function ‘int main(int, char**)’:
/home/noetic/xrslam/xrslam-ros/src/xrslam-ros/src/xrslam_node.cpp:143:79: error: too few arguments to function ‘int XRSLAMCreate(const char*, const char*, const char*, const char*, void**)’
  143 |         slam_config_path.c_str(), device_config_path.c_str(), "", "XRSLAM ROS");

Update: I had to modify the function declaration in xrslam-interface/include/XRSLAM.h:

int XRSLAMCreate(const char *slam_config_path, const char *device_config_path,
                 const char *license_path, const char *product_name,
                 void **config);

, to be:

int XRSLAMCreate(const char *slam_config_path, const char *device_config_path,
                 const char *license_path, const char *product_name);

After that I was able to build, but once I do roslaunch xrslam_ros euroc.launch I get process has died

MengNan-Li commented 3 months ago
void *yaml_config = nullptr;
int create_succ = XRSLAMCreate(
    slam_config_path.c_str(), device_config_path.c_str(), "", "XRSLAM ROS", &yaml_config);
cmakelabs commented 3 months ago

Thank you very much, it works