- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to learn about realsense and I want use the realsense for my project. I started by installing librealsense in Ubuntu 16.04 following the documentation. After I installed the library, I want to try the example code hello-realsense and compile it. This is what I got.
Scanning dependencies of target rs-hello-realsense
[ 50%] Building CXX object CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o
[100%] Linking CXX executable rs-hello-realsense
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::error::error(rs2_error*)':
rs-hello-realsense.cpp:(.text._ZN3rs25errorC2EP9rs2_error[_ZN3rs25errorC5EP9rs2_error]+0x2a): undefined reference to `rs2_get_error_message'
rs-hello-realsense.cpp:(.text._ZN3rs25errorC2EP9rs2_error[_ZN3rs25errorC5EP9rs2_error]+0x74): undefined reference to `rs2_get_failed_function'
rs-hello-realsense.cpp:(.text._ZN3rs25errorC2EP9rs2_error[_ZN3rs25errorC5EP9rs2_error]+0x9b): undefined reference to `rs2_get_failed_function'
rs-hello-realsense.cpp:(.text._ZN3rs25errorC2EP9rs2_error[_ZN3rs25errorC5EP9rs2_error]+0x102): undefined reference to `rs2_get_failed_args'
rs-hello-realsense.cpp:(.text._ZN3rs25errorC2EP9rs2_error[_ZN3rs25errorC5EP9rs2_error]+0x129): undefined reference to `rs2_get_failed_args'
rs-hello-realsense.cpp:(.text._ZN3rs25errorC2EP9rs2_error[_ZN3rs25errorC5EP9rs2_error]+0x190): undefined reference to `rs2_get_librealsense_exception_type'
rs-hello-realsense.cpp:(.text._ZN3rs25errorC2EP9rs2_error[_ZN3rs25errorC5EP9rs2_error]+0x1a5): undefined reference to `rs2_free_error'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::error::handle(rs2_error*)':
rs-hello-realsense.cpp:(.text._ZN3rs25error6handleEP9rs2_error[_ZN3rs25error6handleEP9rs2_error]+0x22): undefined reference to `rs2_get_librealsense_exception_type'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::stream_profile::stream_profile(rs2_stream_profile const*)':
rs-hello-realsense.cpp:(.text._ZN3rs214stream_profileC2EPK18rs2_stream_profile[_ZN3rs214stream_profileC5EPK18rs2_stream_profile]+0xc1): undefined reference to `rs2_get_stream_profile_data'
rs-hello-realsense.cpp:(.text._ZN3rs214stream_profileC2EPK18rs2_stream_profile[_ZN3rs214stream_profileC5EPK18rs2_stream_profile]+0xe7): undefined reference to `rs2_is_stream_profile_default'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::frame::~frame()':
rs-hello-realsense.cpp:(.text._ZN3rs25frameD2Ev[_ZN3rs25frameD5Ev]+0x23): undefined reference to `rs2_release_frame'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::frame::get_profile() const':
rs-hello-realsense.cpp:(.text._ZNK3rs25frame11get_profileEv[_ZNK3rs25frame11get_profileEv]+0x39): undefined reference to `rs2_get_frame_stream_profile'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::frame::add_ref() const':
rs-hello-realsense.cpp:(.text._ZNK3rs25frame7add_refEv[_ZNK3rs25frame7add_refEv]+0x35): undefined reference to `rs2_frame_add_ref'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::frame::reset()':
rs-hello-realsense.cpp:(.text._ZN3rs25frame5resetEv[_ZN3rs25frame5resetEv]+0x23): undefined reference to `rs2_release_frame'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::video_frame::video_frame(rs2::frame const&)':
rs-hello-realsense.cpp:(.text._ZN3rs211video_frameC2ERKNS_5frameE[_ZN3rs211video_frameC5ERKNS_5frameE]+0x6d): undefined reference to `rs2_is_frame_extendable_to'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::video_frame::get_width() const':
rs-hello-realsense.cpp:(.text._ZNK3rs211video_frame9get_widthEv[_ZNK3rs211video_frame9get_widthEv]+0x3d): undefined reference to `rs2_get_frame_width'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::video_frame::get_height() const':
rs-hello-realsense.cpp:(.text._ZNK3rs211video_frame10get_heightEv[_ZNK3rs211video_frame10get_heightEv]+0x3d): undefined reference to `rs2_get_frame_height'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::depth_frame::depth_frame(rs2::frame const&)':
rs-hello-realsense.cpp:(.text._ZN3rs211depth_frameC2ERKNS_5frameE[_ZN3rs211depth_frameC5ERKNS_5frameE]+0x6d): undefined reference to `rs2_is_frame_extendable_to'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::depth_frame::get_distance(int, int) const':
rs-hello-realsense.cpp:(.text._ZNK3rs211depth_frame12get_distanceEii[_ZNK3rs211depth_frame12get_distanceEii]+0x45): undefined reference to `rs2_depth_frame_get_distance'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::frameset::frameset(rs2::frame const&)':
rs-hello-realsense.cpp:(.text._ZN3rs28framesetC2ERKNS_5frameE[_ZN3rs28framesetC5ERKNS_5frameE]+0x79): undefined reference to `rs2_is_frame_extendable_to'
rs-hello-realsense.cpp:(.text._ZN3rs28framesetC2ERKNS_5frameE[_ZN3rs28framesetC5ERKNS_5frameE]+0xe2): undefined reference to `rs2_embedded_frames_count'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::context::context()':
rs-hello-realsense.cpp:(.text._ZN3rs27contextC2Ev[_ZN3rs27contextC5Ev]+0x3d): undefined reference to `rs2_create_context'
rs-hello-realsense.cpp:(.text._ZN3rs27contextC2Ev[_ZN3rs27contextC5Ev]+0x49): undefined reference to `rs2_delete_context'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::pipeline::pipeline(rs2::context)':
rs-hello-realsense.cpp:(.text._ZN3rs28pipelineC2ENS_7contextE[_ZN3rs28pipelineC5ENS_7contextE]+0x4e): undefined reference to `rs2_create_pipeline'
rs-hello-realsense.cpp:(.text._ZN3rs28pipelineC2ENS_7contextE[_ZN3rs28pipelineC5ENS_7contextE]+0x5a): undefined reference to `rs2_delete_pipeline'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::pipeline::start()':
rs-hello-realsense.cpp:(.text._ZN3rs28pipeline5startEv[_ZN3rs28pipeline5startEv]+0x42): undefined reference to `rs2_pipeline_start'
rs-hello-realsense.cpp:(.text._ZN3rs28pipeline5startEv[_ZN3rs28pipeline5startEv]+0x4e): undefined reference to `rs2_delete_pipeline_profile'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `rs2::pipeline::wait_for_frames(unsigned int) const':
rs-hello-realsense.cpp:(.text._ZNK3rs28pipeline15wait_for_framesEj[_ZNK3rs28pipeline15wait_for_framesEj]+0x47): undefined reference to `rs2_pipeline_wait_for_frames'
CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o: In function `void rs2::frameset::foreach<rs2::frameset::first_or_default(rs2_stream, rs2_format) const::{lambda(rs2::frame)#1}>(rs2::frameset::first_or_default(rs2_stream, rs2_format) const::{lambda(rs2::frame)#1}) const':
rs-hello-realsense.cpp:(.text._ZNK3rs28frameset7foreachIZNKS0_16first_or_defaultE10rs2_stream10rs2_formatEUlNS_5frameEE_EEvT_[_ZNK3rs28frameset7foreachIZNKS0_16first_or_defaultE10rs2_stream10rs2_formatEUlNS_5frameEE_EEvT_]+0x7d): undefined reference to `rs2_extract_frame'
collect2: error: ld returned 1 exit status
CMakeFiles/rs-hello-realsense.dir/build.make:83: recipe for target 'rs-hello-realsense' failed
make[2]: *** [rs-hello-realsense] Error 1
CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/rs-hello-realsense.dir/all' failed
make[1]: *** [CMakeFiles/rs-hello-realsense.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
First I opened the hello-realsense folder, then I made a build folder, cd to build folder, cmake ../, and make. Please let me know if I made mistakes, since I'm new to Ubuntu. Any help would be appreciated. Thank you.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you delete the content of the build directory please and then try re-running both CMAKE and MAKE using the instructions below:
cd ~/librealsense
sudo rm -rf ./build/
mkdir build && cd build
cmake .. -DBUILD_EXAMPLES=true && make -J && sudo make install
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you sir, now all the examples are compiled. But if I want to use librealsense for my project (using #include <librealsense2/rs.hpp> for example) how should I compile my project? Compiling a whole project would take time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad it helped!
I hope the advice in the link below helps you to use CMake to add the Librealsense library to your own projects.
https://github.com/IntelRealSense/librealsense/issues/4277#issuecomment-505242118
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page