Livox ros2 driver packages compile error

asked 2023-08-04 05:01:07 -0500

Vsh_fd gravatar image

Hello,

I got the source code from Livox official github website: https://github.com/Livox-SDK/livox_ro... And I get the following error when compile:

--- stderr: livox_sdk_vendor                                              
In file included from /home/astr/Astr/ws_livox/build/livox_sdk_vendor/livox-sdk-v2.3.0-prefix/src/livox-sdk-v2.3.0/sdk_core/src/base/thread_base.cpp:25:
/home/astr/Astr/ws_livox/build/livox_sdk_vendor/livox-sdk-v2.3.0-prefix/src/livox-sdk-v2.3.0/sdk_core/src/base/thread_base.h:46:8: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   46 |   std::shared_ptr<std::thread> thread_;
      |        ^~~~~~~~~~

/home/astr/Astr/ws_livox/build/livox_sdk_vendor/livox-sdk-v2.3.0-prefix/src/livox-sdk-v2.3.0/sdk_core/src/base/thread_base.h:30:1: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
   29 | #include "noncopyable.h"
  +++ |+#include <memory>
   30 | 
/home/astr/Astr/ws_livox/build/livox_sdk_vendor/livox-sdk-v2.3.0-prefix/src/livox-sdk-v2.3.0/sdk_core/src/base/thread_base.cpp: In member function ‘virtual bool livox::ThreadBase::Start()’:
/home/astr/Astr/ws_livox/build/livox_sdk_vendor/livox-sdk-v2.3.0-prefix/src/livox-sdk-v2.3.0/sdk_core/src/base/thread_base.cpp:34:3: error: ‘thread_’ was not declared in this scope; did you mean ‘pthread_t’?

   34 |   thread_ = std::make_shared<std::thread>(&ThreadBase::ThreadFunc, this);
      |   ^~~~~~~
      |   pthread_t

I try to add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") to my CmakeList but it doesn't work.

Thank you for your help.

edit retag flag offensive close merge delete