-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
undefined reference to rs2 #10715
Comments
Hi @Yoki-pjx The set of official RealSense SDK example programs such as rs-hello-realsense are built differently from the method used to compile your own self-created scripts. The SDK builds all of the examples instead of individual ones. If one of the SDK examples is subsequently modified and the set of examples is built again, CMake only updates the programs that have been modified instead of building all of the programs again. This is discussed at #6797 When copying the official example project code into your own script, there will therefore likely be dependencies that are unable to be found when the script is built. I recommend studying the Getting Started C++ tutorial project at the link below. It has the same script as rs-hello-realsense but a more complex CMakeLists.txt file that enables the librealsense library to be found by the project when it is built. https://github.com/zivsha/librealsense/tree/getting_started_example/examples/getting-started |
Thank you for replying. The getting started tutorial project helps a lot. I get some problem when I try to capture two images for color and depth as in the rs-capture example. It is different from the getting started tutorial project, it requires some functions for the example.hpp which also links to other head files like > third-party/stb_easy_font.h The file structure layouts are as follow: I imitated and wrote two CMakeLists.txt as follows:
./capture/CMakeLists.txt
I put the example.hpp and the rs-capture.cpp in the same folder and include the third-party head files in the CMakeLists.txt as However, I still got errors after
Could you help to point out where I'm going wrong with it? Or any other tutorials that call the functions? |
The CMakeLists.txt file for the rs-capture example can be found here: https://github.com/IntelRealSense/librealsense/blob/master/examples/capture/CMakeLists.txt Your CMakeLists.txt file seems to be missing some of the instructions for rs-capture that are in the above file. |
Hi @Yoki-pjx Do you require further assistance with this case, please? Thanks! |
Hi @MartyG-RealSense , |
You're very welcome @Yoki-pjx and I am pleased that I could help. Thanks for the update! |
Issue Description
Hello, I am a freshman who is using the real sense camera for the first time. I have followed the guide of installation for Raspberry Pi 4 to install the real sense library. My camera works with the realsense viwer and also works with the python example codes. However, it fails when I try to run the C++ example codes. It occurs errors as follow:
It's my first time using the Cmake, I didn't make a change to the file
Under my understanding, I got errors because the cmake file did not find the rs2 library. I am not sure if my operation is collect. I did
cmake .
andmake
, then got errors. I find the executable files in /usr/local/bin, and they works. Sorry for raise a question as I am a freshman with Cmake, I have reinstalled it three times but it still doesn't work.If someone may help, I appreciate.
The text was updated successfully, but these errors were encountered: