I have installed Proj 6.3.1 and I tried to run a Proj example from https://proj.org/development/quickstart.html. I implemented it with CLion on Ubuntu 20.04. And I got many undefined reference errors as follows,
cd "/path_to_the_file/" && g++ transformation.cpp -o transformation && "/path_to_the_file/"transformation
/usr/bin/ld: /tmp/cckO2X58.o: in function `main':
transformation.cpp:(.text+0x1f): undefined reference to `proj_context_create'
/usr/bin/ld: transformation.cpp:(.text+0x42): undefined reference to `proj_create_crs_to_crs'
/usr/bin/ld: transformation.cpp:(.text+0x8a): undefined reference to `proj_normalize_for_visualization'
/usr/bin/ld: transformation.cpp:(.text+0xcb): undefined reference to `proj_destroy'
/usr/bin/ld: transformation.cpp:(.text+0x102): undefined reference to `proj_coord'
/usr/bin/ld: transformation.cpp:(.text+0x14f): undefined reference to `proj_trans'
/usr/bin/ld: transformation.cpp:(.text+0x1c3): undefined reference to `proj_trans'
/usr/bin/ld: transformation.cpp:(.text+0x21c): undefined reference to `proj_destroy'
/usr/bin/ld: transformation.cpp:(.text+0x228): undefined reference to `proj_context_destroy'
collect2: error: ld returned 1 exit status
This problem is similar to https://gis.stackexchange.com/questions/370771/unable-to-run-proj-c-example, but I can't find the solutions accordingly. The <proj.h> header is in my usr/include folder and Clion can detect it automatically. Could anyone help?
Related
I am trying to integrate librealsense C++ CLion Project on Ubuntu 20.04.
Compiling the Librealsense separately in the terminal works just as expected.
the Project looks like this:
RS_Pipeline
.
├── build
├── main.cpp
├── CMakeLists.txt
└── librealsense // the integrated lib
├── CMakeLists.txt
├── third-party // libs like GLFW and GLAD which are use in the examples
├── examples //
| ├── example.hpp // with class to generate OpenGL Window
└── ...
The CMakeLists.txt in the base Folder looks rather simple:
cmake_minimum_required(VERSION 3.2)
project(RS_Pipeline LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 11)
set(OpenGL_GL_PREFERENCE LEGACY)
add_executable(RS_Pipeline main.cpp librealsense/examples/example.hpp)
add_subdirectory(librealsense)
target_link_libraries(${PROJECT_NAME} realsense2)
As soon as i try to include the submodul into my CLion Project i get a ton of: main.cpp:(.text+0x23c): undefined reference to glViewport error messages and building my main.cpp in the base dir fails.
somehow the #include <librealsense2/rs.hpp> #include "librealsense/examples/example.hpp"
works fine and even the intellisense finds all the functions.
PLUS: the included examples within the librealsense Library also compile without any problem. (They use exactly the same #include "librealsense/examples/example.hpp".
It looks like, that CLion just dose not link find the right openGL in my own main.cpp resp. if i include it from example.hpp.
====================[ Build | RS_Pipeline | Release ]===========================
/snap/clion/175/bin/cmake/linux/bin/cmake --build /home/lukas/Development/Cpp/RS_Pipeline/cmake-build-release --target RS_Pipeline
[0/1] Re-running CMake...
-- Checking internet connection...
-- Internet connection identified
-- Info: REALSENSE_VERSION_STRING=2.50.0
-- Setting Unix configurations
-- Building libcurl enabled
-- using RS2_USE_V4L2_BACKEND
-- Could NOT find apriltag (missing: APRILTAG_INC APRILTAG_LIB)
-- Unable to find apriltag library, skipping pose-apriltag example
-- Check for updates capability added to realsense-viewer
-- Check for updates capability added to realsense-depth-quality
-- Building with TM2
-- Fetching recommended firmwares:
-- D4XX_FW_VERSION: 5.13.0.50
-- SR3XX_FW_VERSION: 3.26.1.0
-- T26X_FW_VERSION: 0.2.0.951
-- L51X_FW_VERSION: 1.5.8.1
-- L53X_FW_VERSION: 3.5.5.1
-- https://librealsense.intel.com/Releases/RS4xx/FW/D4XX_FW_Image-5.13.0.50.bin
-- Download firmware 0;"returning early; file already exists with expected SHA1 hash" for D4XX_FW_Image-5.13.0.50.bin
-- https://librealsense.intel.com/Releases/SR300/FW/SR3XX_FW_Image-3.26.1.0.bin
-- Download firmware 0;"returning early; file already exists with expected SHA1 hash" for SR3XX_FW_Image-3.26.1.0.bin
-- https://librealsense.intel.com/Releases/TM2/FW/target/0.2.0.951/target-0.2.0.951.mvcmd
-- Download firmware 0;"returning early; file already exists with expected SHA1 hash" for target-0.2.0.951.mvcmd
-- https://librealsense.intel.com/Releases/L5xx/FW/L51X_FW_Image-1.5.8.1.bin
-- Download firmware 0;"returning early; file already exists with expected SHA1 hash" for L51X_FW_Image-1.5.8.1.bin
-- https://librealsense.intel.com/Releases/L5xx/FW/L53X_FW_Image-3.5.5.1.bin
-- Download firmware 0;"returning early; file already exists with expected SHA1 hash" for L53X_FW_Image-3.5.5.1.bin
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lukas/Development/Cpp/RS_Pipeline/cmake-build-release
[1/1] Linking CXX executable RS_Pipeline
FAILED: RS_Pipeline
: && /usr/bin/c++ -O3 -DNDEBUG -rdynamic CMakeFiles/RS_Pipeline.dir/main.cpp.o -o RS_Pipeline -Wl,-rpath,/home/lukas/Development/Cpp/RS_Pipeline/cmake-build-release/librealsense librealsense/librealsense2.so.2.50.0 -lglfw && :
/usr/bin/ld: CMakeFiles/RS_Pipeline.dir/main.cpp.o: in function `set_viewport(rect const&)':
main.cpp:(.text+0x23c): undefined reference to `glViewport'
/usr/bin/ld: main.cpp:(.text+0x241): undefined reference to `glLoadIdentity'
/usr/bin/ld: main.cpp:(.text+0x24b): undefined reference to `glMatrixMode'
/usr/bin/ld: CMakeFiles/RS_Pipeline.dir/main.cpp.o: in function `draw_pointcloud(float, float, glfw_state&, rs2::points&)':
main.cpp:(.text+0x2bb): undefined reference to `glLoadIdentity'
/usr/bin/ld: main.cpp:(.text+0x2c5): undefined reference to `glPushAttrib'
/usr/bin/ld: main.cpp:(.text+0x2e0): undefined reference to `glClearColor'
/usr/bin/ld: main.cpp:(.text+0x2ea): undefined reference to `glClear'
/usr/bin/ld: main.cpp:(.text+0x2f4): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0x2f9): undefined reference to `glPushMatrix'
/usr/bin/ld: main.cpp:(.text+0x32a): undefined reference to `gluPerspective'
/usr/bin/ld: main.cpp:(.text+0x334): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0x339): undefined reference to `glPushMatrix'
/usr/bin/ld: main.cpp:(.text+0x36c): undefined reference to `gluLookAt'
/usr/bin/ld: main.cpp:(.text+0x394): undefined reference to `glTranslatef'
/usr/bin/ld: main.cpp:(.text+0x3b2): undefined reference to `glRotated'
/usr/bin/ld: main.cpp:(.text+0x3cf): undefined reference to `glRotated'
/usr/bin/ld: main.cpp:(.text+0x3e3): undefined reference to `glTranslatef'
/usr/bin/ld: main.cpp:(.text+0x3f6): undefined reference to `glPointSize'
/usr/bin/ld: main.cpp:(.text+0x400): undefined reference to `glEnable'
/usr/bin/ld: main.cpp:(.text+0x40a): undefined reference to `glEnable'
/usr/bin/ld: main.cpp:(.text+0x417): undefined reference to `glBindTexture'
/usr/bin/ld: main.cpp:(.text+0x437): undefined reference to `glTexParameterfv'
/usr/bin/ld: main.cpp:(.text+0x44b): undefined reference to `glTexParameteri'
/usr/bin/ld: main.cpp:(.text+0x45f): undefined reference to `glTexParameteri'
/usr/bin/ld: main.cpp:(.text+0x466): undefined reference to `glBegin'
/usr/bin/ld: main.cpp:(.text+0x516): undefined reference to `glEnd'
/usr/bin/ld: main.cpp:(.text+0x51b): undefined reference to `glPopMatrix'
/usr/bin/ld: main.cpp:(.text+0x525): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0x52a): undefined reference to `glPopMatrix'
/usr/bin/ld: main.cpp:(.text+0x52f): undefined reference to `glPopAttrib'
/usr/bin/ld: main.cpp:(.text+0x558): undefined reference to `glVertex3fv'
/usr/bin/ld: main.cpp:(.text+0x566): undefined reference to `glTexCoord2fv'
/usr/bin/ld: CMakeFiles/RS_Pipeline.dir/main.cpp.o: in function `draw_pointcloud_wrt_world(float, float, glfw_state&, rs2::points&, rs2_pose&, float*, std::vector >&)':
main.cpp:(.text+0x98b): undefined reference to `glLoadIdentity'
/usr/bin/ld: main.cpp:(.text+0x995): undefined reference to `glPushAttrib'
/usr/bin/ld: main.cpp:(.text+0x9b0): undefined reference to `glClearColor'
/usr/bin/ld: main.cpp:(.text+0x9ba): undefined reference to `glClear'
/usr/bin/ld: main.cpp:(.text+0x9c4): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0x9c9): undefined reference to `glPushMatrix'
/usr/bin/ld: main.cpp:(.text+0x9fa): undefined reference to `gluPerspective'
/usr/bin/ld: main.cpp:(.text+0xa04): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0xa09): undefined reference to `glPushMatrix'
/usr/bin/ld: main.cpp:(.text+0xa2f): undefined reference to `glTranslatef'
/usr/bin/ld: main.cpp:(.text+0xa4a): undefined reference to `glRotated'
/usr/bin/ld: main.cpp:(.text+0xa65): undefined reference to `glRotated'
/usr/bin/ld: main.cpp:(.text+0xa79): undefined reference to `glTranslatef'
/usr/bin/ld: main.cpp:(.text+0xa83): undefined reference to `glEnable'
/usr/bin/ld: main.cpp:(.text+0xa90): undefined reference to `glLineWidth'
/usr/bin/ld: main.cpp:(.text+0xa9a): undefined reference to `glBegin'
/usr/bin/ld: main.cpp:(.text+0xac4): undefined reference to `glColor3f'
/usr/bin/ld: main.cpp:(.text+0xad8): undefined reference to `glVertex3f'
/usr/bin/ld: main.cpp:(.text+0xae2): undefined reference to `glEnd'
/usr/bin/ld: main.cpp:(.text+0xaef): undefined reference to `glLineWidth'
/usr/bin/ld: main.cpp:(.text+0xb02): undefined reference to `glColor3f'
/usr/bin/ld: main.cpp:(.text+0xb2f): undefined reference to `glMultMatrixf'
/usr/bin/ld: main.cpp:(.text+0xb37): undefined reference to `glMultMatrixf'
/usr/bin/ld: main.cpp:(.text+0xb4a): undefined reference to `glPointSize'
/usr/bin/ld: main.cpp:(.text+0xb54): undefined reference to `glEnable'
/usr/bin/ld: main.cpp:(.text+0xb5e): undefined reference to `glEnable'
/usr/bin/ld: main.cpp:(.text+0xb71): undefined reference to `glBindTexture'
/usr/bin/ld: main.cpp:(.text+0xb91): undefined reference to `glTexParameterfv'
/usr/bin/ld: main.cpp:(.text+0xba5): undefined reference to `glTexParameteri'
/usr/bin/ld: main.cpp:(.text+0xbb9): undefined reference to `glTexParameteri'
/usr/bin/ld: main.cpp:(.text+0xbc0): undefined reference to `glBegin'
/usr/bin/ld: main.cpp:(.text+0xc76): undefined reference to `glEnd'
/usr/bin/ld: main.cpp:(.text+0xc7b): undefined reference to `glPopMatrix'
/usr/bin/ld: main.cpp:(.text+0xc85): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0xc8a): undefined reference to `glPopMatrix'
/usr/bin/ld: main.cpp:(.text+0xc8f): undefined reference to `glPopAttrib'
/usr/bin/ld: main.cpp:(.text+0xcc0): undefined reference to `glVertex3fv'
/usr/bin/ld: main.cpp:(.text+0xcce): undefined reference to `glTexCoord2fv'
/usr/bin/ld: CMakeFiles/RS_Pipeline.dir/main.cpp.o: in function `set_viewport(rect const&)':
main.cpp:(.text+0x27b): undefined reference to `glOrtho'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
The examples all include this file, while you don't:
find_package(OpenGL REQUIRED)
set(DEPENDENCIES realsense2 glfw ${OPENGL_LIBRARIES})
which makes the realsense2 library depend on GLFW and your OpenGL stack.
Add the following to your CMakeLists.txt:
find_package(OpenGL REQUIRED)
target_link_libraries(${PROJECT_NAME} glfw OpenGL::GL )
#Botje Thanks a lot, that was fast! now it is working with the following CMakeLists:
cmake_minimum_required(VERSION 3.2)
project(RS_Pipeline LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 11)
set(OpenGL_GL_PREFERENCE LEGACY)
find_package(OpenGL REQUIRED)
add_executable(RS_Pipeline main.cpp librealsense/examples/example.hpp)
add_subdirectory(librealsense)
target_link_libraries(${PROJECT_NAME}
realsense2
glfw OpenGL::GL
glfw OpenGL::GLU
)
looks like this topic can be closed already.
I downloaded and built the wxWidgets library on Ubuntu 21.04 using the following flags:
--enable-monolithic
--disable-shared
--enable-cxx11
--enable-stl
--enable-std_containers_compat
--enable-std_iostreams
--enable-std_string
--enable-std_string_conv_in_wxstring
--disable-unsafe_conv_in_wxstring
--enable-utf8
--enable-profile
--disable-vararg_macros
--enable-universal_binary
--enable-intl
--enable-config
--enable-protocols
--enable-ftp
--enable-http
--enable-fileproto
--enable-sockets
--enable-ipv6
--enable-dataobj
--enable-webrequest
--enable-ipc
--enable-baseevtloop
--enable-epollloop
--enable-selectloop
--enable-any
--enable-arcstream
--enable-base64
--enable-backtrace
--enable-catch_segvs
--enable-cmdline
--enable-datetime
--enable-debugreport
--enable-dialupman
--enable-dynlib
--enable-dynamicloader
--enable-exceptions
--enable-ffile
--enable-file
--enable-filehistory
--enable-filesystem
--enable-fontenum
--enable-fontmap
--enable-fs_archive
--enable-fs_inet
--enable-fsvolume
--enable-fswatcher
--enable-geometry
--enable-log
--enable-longlong
--enable-mimetype
--enable-printfposparam
--enable-secretstore
--enable-snglinst
--enable-sound
--enable-stdpaths
--enable-stopwatch
--enable-streams
--enable-sysoptions
--enable-tarstream
--enable-textbuf
--enable-textfile
--enable-timer
--enable-variant
--enable-zipstream
--enable-url
--enable-protocol
--enable-protocol-http
--enable-protocol-ftp
--enable-protocol-file
--enable-threads
--enable-docview
--enable-help
--enable-html
--enable-htmlhelp
--enable-xrc
--enable-aui
--enable-propgrid
--enable-ribbon
--enable-stc
--enable-constraints
--enable-loggui
--enable-logwin
--enable-logdialog
--enable-mdi
--enable-mdidoc
--enable-mediactrl
--enable-richtext
--enable-postscript
--enable-printarch
--enable-svg
--enable-webview
--enable-graphics_ctx
--enable-clipboard
--enable-dnd
--enable-markup
--enable-accel
--enable-actindicator
--enable-addremovectrl
--enable-animatectrl
--enable-bannerwindow
--enable-artstd
--enable-arttango
--enable-bmpbutton
--enable-bmpcombobox
--enable-button
--enable-calendar
--enable-caret
--enable-checkbox
--enable-checklst
--enable-choice
--enable-choicebook
--enable-collpane
--enable-colourpicker
--enable-combobox
--enable-comboctrl
--enable-commandlinkbutton
--enable-dataviewctrl
--enable-datepick
--enable-detect_sm
--enable-dirpicker
--enable-display
--enable-editablebox
--enable-filectrl
--enable-filepicker
--enable-fontpicker
--enable-gauge
--enable-grid
--enable-headerctrl
--enable-hyperlink
--enable-imaglist
--enable-infobar
--enable-listbook
--enable-listbox
--enable-listctrl
--enable-notebook
--enable-notifmsg
--enable-odcombobox
--enable-popupwin
--enable-prefseditor
--enable-privatefonts
--enable-radiobox
--enable-radiobtn
--enable-richmsgdlg
--enable-richtooltip
--enable-rearrangectrl
--enable-sash
--enable-scrollbar
--enable-searchctrl
--enable-slider
--enable-spinbtn
--enable-spinctrl
--enable-splitter
--enable-statbmp
--enable-statbox
--enable-statline
--enable-stattext
--enable-statusbar
--enable-taskbaricon
--enable-tbarnative
--enable-textctrl
--enable-timepick
--enable-tipwindow
--enable-togglebtn
--enable-toolbar
--enable-toolbook
--enable-treebook
--enable-treectrl
--enable-treelist
--enable-commondlg
--enable-aboutdlg
--enable-choicedlg
--enable-coldlg
--enable-creddlg
--enable-filedlg
--enable-finddlg
--enable-fontdlg
--enable-dirdlg
--enable-msgdlg
--enable-numberdlg
--enable-splash
--enable-textdlg
--enable-tipdlg
--enable-progressdlg
--enable-wizarddlg
--enable-menus
--enable-menubar
--enable-miniframe
--enable-tooltips
--enable-splines
--enable-mousewheel
--enable-validators
--enable-busyinfo
--enable-hotkey
--enable-joystick
--enable-metafile
--enable-dragimage
--enable-dctransform
--enable-webviewwebkit
--enable-palette
--enable-image
--enable-gif
--enable-pcx
--enable-tga
--enable-iff
--enable-pnm
--enable-xpm
--enable-ico_cur
--enable-autoidman
I used all these flags because I mainly want to play around with the library and having a static, monolithic library with all the features enabled suits that purpose. At first I faced some issues at configuration with GStreamer which wasn't installed but after I installed it the library compiled just fine. For the sake of completeness, these are the exact steps I followed:
#Current dir -> ~/Programs/C++/wxWidgets-3.1.5
mkdir build-gtk
cd build-gtk
../configure #all the above flags
make
sudo checkinstall
and finally I installed the library through the generated .deb file.
I then proceeded to build the sample files with the provided make files. All but two compiled, mediaplayer and splash directories. Again, the exact procedure I followed was:
cd samples
make
The error I got for mediaplayer is:
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `draw':
mediactrl.cpp:(.text+0x195): undefined reference to `gst_video_overlay_expose'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::SetPosition(wxLongLongNative)':
mediactrl.cpp:(.text+0x200): undefined reference to `gst_element_seek'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::GetDuration()':
mediactrl.cpp:(.text+0x24f): undefined reference to `gst_element_query_duration'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::GetDownloadTotal()':
mediactrl.cpp:(.text+0x2cf): undefined reference to `gst_element_query_duration'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::GetPosition()':
mediactrl.cpp:(.text+0x545): undefined reference to `gst_element_query_position'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `gtk_window_realize_callback':
mediactrl.cpp:(.text+0x615): undefined reference to `gst_video_overlay_set_window_handle'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::~wxGStreamerMediaBackend()':
mediactrl.cpp:(.text+0x6e6): undefined reference to `gst_object_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0x75a): undefined reference to `gst_element_set_state'
/usr/bin/ld: mediactrl.cpp:(.text+0x75f): undefined reference to `gst_object_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0x773): undefined reference to `gst_object_unref'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::SetupXOverlay()':
mediactrl.cpp:(.text+0x918): undefined reference to `gst_video_overlay_set_window_handle'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::TryAudioSink(_GstElement*)':
mediactrl.cpp:(.text+0xac8): undefined reference to `gst_element_get_type'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::TryVideoSink(_GstElement*)':
mediactrl.cpp:(.text+0xb5e): undefined reference to `gst_bin_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xb89): undefined reference to `gst_video_overlay_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xbaf): undefined reference to `gst_bin_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xbd1): undefined reference to `gst_video_overlay_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xbd9): undefined reference to `gst_bin_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xbef): undefined reference to `gst_bin_get_by_interface'
/usr/bin/ld: mediactrl.cpp:(.text+0xbfb): undefined reference to `gst_video_overlay_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xc2a): undefined reference to `gst_element_set_state'
/usr/bin/ld: mediactrl.cpp:(.text+0xc50): undefined reference to `gst_video_overlay_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xc61): undefined reference to `gst_video_overlay_get_type'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::CreateControl(wxControl*, wxWindow*, int, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&)':
mediactrl.cpp:(.text+0x100c): undefined reference to `gst_init_check'
/usr/bin/ld: mediactrl.cpp:(.text+0x122a): undefined reference to `gst_element_factory_make'
/usr/bin/ld: mediactrl.cpp:(.text+0x1236): undefined reference to `gst_element_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0x190c): undefined reference to `gst_element_get_bus'
/usr/bin/ld: mediactrl.cpp:(.text+0x191e): undefined reference to `gst_bus_add_watch'
/usr/bin/ld: mediactrl.cpp:(.text+0x1927): undefined reference to `gst_element_get_bus'
/usr/bin/ld: mediactrl.cpp:(.text+0x193b): undefined reference to `gst_bus_set_sync_handler'
/usr/bin/ld: mediactrl.cpp:(.text+0x194e): undefined reference to `gst_element_factory_make'
/usr/bin/ld: mediactrl.cpp:(.text+0x1977): undefined reference to `gst_element_factory_make'
/usr/bin/ld: mediactrl.cpp:(.text+0x19a0): undefined reference to `gst_element_factory_make'
/usr/bin/ld: mediactrl.cpp:(.text+0x1b4f): undefined reference to `gst_element_factory_make'
/usr/bin/ld: mediactrl.cpp:(.text+0x1b7f): undefined reference to `gst_element_factory_make'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o):mediactrl.cpp:(.text+0x1ba8): more undefined references to `gst_element_factory_make' follow
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::CreateControl(wxControl*, wxWindow*, int, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&)':
mediactrl.cpp:(.text+0x1d2b): undefined reference to `gst_element_get_static_pad'
/usr/bin/ld: mediactrl.cpp:(.text+0x1d5c): undefined reference to `gst_object_unref'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::Play()':
mediactrl.cpp:(.text+0x30d1): undefined reference to `gst_element_set_state'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::Pause()':
mediactrl.cpp:(.text+0x312c): undefined reference to `gst_element_set_state'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::QueryVideoSizeFromPad(_GstPad*)':
mediactrl.cpp:(.text+0x3f44): undefined reference to `gst_pad_get_current_caps'
/usr/bin/ld: mediactrl.cpp:(.text+0x3f5a): undefined reference to `gst_caps_get_structure'
/usr/bin/ld: mediactrl.cpp:(.text+0x3f79): undefined reference to `gst_structure_get_int'
/usr/bin/ld: mediactrl.cpp:(.text+0x3f8c): undefined reference to `gst_structure_get_int'
/usr/bin/ld: mediactrl.cpp:(.text+0x3fa2): undefined reference to `gst_structure_get_value'
/usr/bin/ld: mediactrl.cpp:(.text+0x40be): undefined reference to `gst_mini_object_unref'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `gst_bus_async_callback':
mediactrl.cpp:(.text+0x5fe7): undefined reference to `gst_message_parse_state_changed'
/usr/bin/ld: mediactrl.cpp:(.text+0x6014): undefined reference to `gst_message_parse_error'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `gst_bus_sync_callback':
mediactrl.cpp:(.text+0x607a): undefined reference to `gst_is_video_overlay_prepare_window_handle_message'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::SyncStateChange(_GstElement*, GstState, long)':
mediactrl.cpp:(.text+0x6497): undefined reference to `gst_element_get_bus'
/usr/bin/ld: mediactrl.cpp:(.text+0x64b0): undefined reference to `gst_bus_have_pending'
/usr/bin/ld: mediactrl.cpp:(.text+0x64f4): undefined reference to `gst_bus_pop'
/usr/bin/ld: mediactrl.cpp:(.text+0x6505): undefined reference to `gst_mini_object_unref'
/usr/bin/ld: mediactrl.cpp:(.text+0x656b): undefined reference to `gst_mini_object_unref'
/usr/bin/ld: mediactrl.cpp:(.text+0x65b9): undefined reference to `gst_message_parse_state_changed'
/usr/bin/ld: mediactrl.cpp:(.text+0x65d3): undefined reference to `gst_mini_object_unref'
/usr/bin/ld: mediactrl.cpp:(.text+0x65fa): undefined reference to `gst_message_parse_error'
/usr/bin/ld: mediactrl.cpp:(.text+0x661c): undefined reference to `gst_mini_object_unref'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaEventHandler::OnMediaFinish(wxMediaEvent&)':
mediactrl.cpp:(.text+0x69d1): undefined reference to `gst_element_set_state'
/usr/bin/ld: mediactrl.cpp:(.text+0x69fa): undefined reference to `gst_element_set_state'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::DoLoad(wxString const&)':
mediactrl.cpp:(.text+0x6ad6): undefined reference to `gst_element_set_state'
/usr/bin/ld: mediactrl.cpp:(.text+0x703a): undefined reference to `gst_element_set_state'
/usr/bin/ld: mediactrl.cpp:(.text+0x7046): undefined reference to `gst_uri_protocol_is_valid'
/usr/bin/ld: mediactrl.cpp:(.text+0x70c0): undefined reference to `gst_uri_is_valid'
/usr/bin/ld: mediactrl.cpp:(.text+0x71f0): undefined reference to `gst_element_set_state'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::Stop()':
mediactrl.cpp:(.text+0x7759): undefined reference to `gst_element_set_state'
collect2: error: ld returned 1 exit status
make tried to compile the the sample running g++ with the following flags (quoting them in separate lines for readability):
g++
-std=gnu++11
-o mediaplayer mediaplayer_mediaplayer.o
-L~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib
-pthread
-pg
-lgstvideo-1.0
-lgstbase-1.0
-lgstreamer-1.0
-lgobject-2.0
-lglib-2.0
-lwx_gtk3u-3.1
-lwxscintilla-3.1
-lwxregexu-3.1
-pthread
-lz
-ldl
-lcurl
-llzma
-lm
-lexpat
-lgtk-3
-lgdk-3
-lpangocairo-1.0
-lpango-1.0
-lharfbuzz
-latk-1.0
-lcairo-gobject
-lcairo
-lgdk_pixbuf-2.0
-lgio-2.0
-lgobject-2.0
-lgthread-2.0
-pthread
-lglib-2.0
-lX11
-lSM
-lgtk-3
-lgdk-3
-lpangocairo-1.0
-lpango-1.0
-lharfbuzz
-latk-1.0
-lcairo-gobject
-lcairo
-lgdk_pixbuf-2.0
-lgio-2.0
-lgobject-2.0
-lglib-2.0
-lnotify
-lgdk_pixbuf-2.0
-lgio-2.0
-lgobject-2.0
-lglib-2.0
-lXtst
-lpangoft2-1.0
-lpango-1.0
-lgobject-2.0
-lglib-2.0
-lharfbuzz
-lfontconfig
-lfreetype
-lpng
-lz
-ljpeg
-ltiff
-llzma
-ljbig
-lz
-ldl
-lcurl
-llzma
-lm
I've been trying two days now to solve this but I can't figured it out. I've tried installing all the possible GStreamer packages, copying the GStreamer libraries and header files to a bunch of different location, I tried --reinstall and other things but at this point I haven't managed to get anywhere. Does anyone know what am I missing here? How can I compile these sample files?
Edit:
As #VZ. pointed out I should make more clear that:
The make files were autogenerated by building wxWidgets library.
There was a makefile in the build-gtk/samples directory which would compile in batch all examples.
In each example (e.g. build-gtk/samples/mediaplayer) there was a makefile generated by a bakefile - the first lines are a block comment saying:
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.12 ([http://www.bakefile.org][1])
# Do not modify, all changes will be overwritten!
# =========================================================================
I ran make in build-gtk/samples, which compiled all examples except build-gtk/samples/mediaplayer and build-gtk/samples/splash.
Following #VZ.'s answer I also tried to manually compile build-gtk/samples/mediaplayer using g++ and changing the order of the libraries I got the following error:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_event_parse_instant_rate_change'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_aggregator_simple_get_next_time'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_base_sink_set_processing_deadline'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_mini_object_add_parent'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_mini_object_remove_parent'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_aggregator_selected_samples'
collect2: error: ld returned 1 exit status
Edit 2:
I fixed the aforementioned error by running the following:
sudo rm /usr/local/lib/libgstbase-1.0.so*
sudo rm /usr/local/lib/libgstreamer-1.0.*
effectively removing any gstreamer libraries under /usr/local/lib that seemed to be conflicting with some other gstreamer libraries elsewhere in the system.
There is a problem with the order of the libraries in the link command you show, gstreamer libraries must come after -lwx_gtk3u-3.1 and not before it as they do, when using static libraries.
It's not clear to me where does this command actually come from, normally you should run make inside build-gtk/samples/mediaplayer directory, is this really what you're doing? I.e. how exactly do you the provided makefiles and which ones are you using?
This looks like a bug in static monolithic build when using media library and should be fixed in wxWidgets itself. I don't know about the new errors, i.e. the missing gst_event_parse_instant_rate_change and other symbols, I don't have anything like this on my system, so I suspect this might be due to a mix of gstreamer libraries on your system due to your previous attempts to circumvent the problem.
P.S. Avoid using all these --enable-xxx options, they're all on by default anyhow (and those that are off are usually off for a good reason).
I'm trying out this library:
https://github.com/dacap/clip
I've git-cloned it, then built it using the following:
cmake .
make
This produces a library called libclip.a.
Now, I've taken the sample Hello World code, which is this:
#include "clip/clip.h"
int main() {
clip::set_text("Hello World");
}
Given that the above is in a file called cliptest2.cpp, I compile it as follows:
g++ -lclip cliptest2.cpp -o cliptest2
Every time, I get the following:
/usr/bin/ld: /tmp/cc71SQmy.o: in function `main':
cliptest2.cpp:(.text+0x47): undefined reference to `clip::set_text(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
collect2: error: ld returned 1 exit status
I do understand how the linker works and have gone through dozens of other questions with similar errors. However, given that I am building the third party library and linking it into my sample program, I don't understand why the set_text() method is not being resolved.
Edit: I've tried a few things, also as a result of the comments below. The source code for the clip library resides at ~/git/clip, and I am compiling cliptest2.cpp from the home directory itself. Therefore, adjusting the command suggested by #MathiasSchmid to my environment, I end up with this:
g++ cliptest2.cpp -I git -L git/clip -lclip -lxcb -lpthread -o cliptest2
I run this on my Kubuntu 20.04 LTS, and get all the following errors:
daniel#orion:~$ g++ cliptest2.cpp -I git -L git/clip -lclip -lxcb -lpthread -o cliptest2
/usr/bin/ld: git/clip/libclip.a(clip_x11.cpp.o): in function `clip::x11::write_data_fn(png_struct_def*, unsigned char*, unsigned long)':
clip_x11.cpp:(.text+0x4f): undefined reference to `png_get_io_ptr'
/usr/bin/ld: git/clip/libclip.a(clip_x11.cpp.o): in function `clip::x11::write_png(clip::image const&, std::vector<unsigned char, std::allocator<unsigned char> >&)':
clip_x11.cpp:(.text+0x117): undefined reference to `png_create_write_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x13a): undefined reference to `png_create_info_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x158): undefined reference to `png_destroy_write_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x17d): undefined reference to `png_set_longjmp_fn'
/usr/bin/ld: clip_x11.cpp:(.text+0x1a5): undefined reference to `png_destroy_write_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x1cb): undefined reference to `png_set_write_fn'
/usr/bin/ld: clip_x11.cpp:(.text+0x232): undefined reference to `png_set_IHDR'
/usr/bin/ld: clip_x11.cpp:(.text+0x249): undefined reference to `png_write_info'
/usr/bin/ld: clip_x11.cpp:(.text+0x255): undefined reference to `png_set_packing'
/usr/bin/ld: clip_x11.cpp:(.text+0x268): undefined reference to `png_get_rowbytes'
/usr/bin/ld: clip_x11.cpp:(.text+0x27a): undefined reference to `png_malloc'
/usr/bin/ld: clip_x11.cpp:(.text+0x3cd): undefined reference to `png_write_rows'
/usr/bin/ld: clip_x11.cpp:(.text+0x3e9): undefined reference to `png_free'
/usr/bin/ld: clip_x11.cpp:(.text+0x3fc): undefined reference to `png_write_end'
/usr/bin/ld: clip_x11.cpp:(.text+0x40f): undefined reference to `png_destroy_write_struct'
/usr/bin/ld: git/clip/libclip.a(clip_x11.cpp.o): in function `clip::x11::read_data_fn(png_struct_def*, unsigned char*, unsigned long)':
clip_x11.cpp:(.text+0x45d): undefined reference to `png_get_io_ptr'
/usr/bin/ld: git/clip/libclip.a(clip_x11.cpp.o): in function `clip::x11::read_png(unsigned char const*, unsigned long, clip::image*, clip::image_spec*)':
clip_x11.cpp:(.text+0x575): undefined reference to `png_create_read_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x5a1): undefined reference to `png_create_info_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x5cd): undefined reference to `png_destroy_read_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x5f5): undefined reference to `png_set_longjmp_fn'
/usr/bin/ld: clip_x11.cpp:(.text+0x628): undefined reference to `png_destroy_read_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x68f): undefined reference to `png_set_read_fn'
/usr/bin/ld: clip_x11.cpp:(.text+0x6a8): undefined reference to `png_read_info'
/usr/bin/ld: clip_x11.cpp:(.text+0x6ea): undefined reference to `png_get_IHDR'
/usr/bin/ld: clip_x11.cpp:(.text+0x747): undefined reference to `png_get_rowbytes'
/usr/bin/ld: clip_x11.cpp:(.text+0x8bf): undefined reference to `png_set_strip_16'
/usr/bin/ld: clip_x11.cpp:(.text+0x8ce): undefined reference to `png_set_packing'
/usr/bin/ld: clip_x11.cpp:(.text+0x8dd): undefined reference to `png_set_expand_gray_1_2_4_to_8'
/usr/bin/ld: clip_x11.cpp:(.text+0x8ec): undefined reference to `png_set_palette_to_rgb'
/usr/bin/ld: clip_x11.cpp:(.text+0x8fb): undefined reference to `png_set_gray_to_rgb'
/usr/bin/ld: clip_x11.cpp:(.text+0x90a): undefined reference to `png_set_tRNS_to_alpha'
/usr/bin/ld: clip_x11.cpp:(.text+0x919): undefined reference to `png_set_interlace_handling'
/usr/bin/ld: clip_x11.cpp:(.text+0x938): undefined reference to `png_read_update_info'
/usr/bin/ld: clip_x11.cpp:(.text+0x95a): undefined reference to `png_malloc'
/usr/bin/ld: clip_x11.cpp:(.text+0x9ab): undefined reference to `png_malloc'
/usr/bin/ld: clip_x11.cpp:(.text+0xa19): undefined reference to `png_read_rows'
/usr/bin/ld: clip_x11.cpp:(.text+0xbe0): undefined reference to `png_free'
/usr/bin/ld: clip_x11.cpp:(.text+0xc05): undefined reference to `png_free'
/usr/bin/ld: clip_x11.cpp:(.text+0xc4b): undefined reference to `png_destroy_read_struct'
collect2: error: ld returned 1 exit status
It is still not clear to me what the problem here is.
I'm using robo robo simulator. It requires SDL to be installed. SDL was successfully installed using sudo apt-get install in Ubuntu
'make' was used to compile and link.
compilation was successful but while linking I got the following linker errors
[LD] roborobo
src/core/roborobo.o: In function `clean_up()':
roborobo.cpp:(.text+0x29): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x35): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x41): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x4d): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x59): undefined reference to `SDL_FreeSurface'
src/core/roborobo.o:roborobo.cpp:(.text+0x6a): more undefined references to `SDL_FreeSurface' follow
src/core/roborobo.o: In function `checkQuitEvent()':
roborobo.cpp:(.text+0xdff): undefined reference to `SDL_PollEvent'
src/core/roborobo.o: In function `handleKeyEvent(unsigned char*)':
roborobo.cpp:(.text+0xead): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0xf1a): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0xf43): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0x1037): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0x111e): undefined reference to `SDL_Delay'
src/core/roborobo.o:roborobo.cpp:(.text+0x1191): more undefined references to `SDL_Delay' follow
and many more
SDL_gfxPrimitives.c:(.text+0x7477): undefined reference to `SDL_UnlockSurface'
SDL_gfxPrimitives.c:(.text+0x7491): undefined reference to `SDL_UpperBlit'
SDL_gfxPrimitives.c:(.text+0x74e6): undefined reference to `SDL_CreateRGBSurface'
collect2: error: ld returned 1 exit status
make: [roborobo] Error 1 (ignored)
the make file also has sdl-config --cflags --libs -lSDL_image
the Makefile is in http://pastebin.com/5EdcZWAd
the entire console output after 'make' is in http://pastebin.com/yXDHR9xw
I am driving nuts....
I'm working on a program to read out Joint Coordinates from an Xtion Primesense sensor with OpenNI and NiTE. I got the program splittet in 3 parts. Main, sensorOpenNI.hpp and sensorOpenNI.cpp. Now while linking the parts together I get lots of errors saying there are undefined references to some NiTE functions. I'm working with Kubuntu and g++. The NiTE and OpenNI libs are in a directory called Include...
Here's the error message:
/tmp/ccrPQHEg.o: In function openni::VideoFrameRef::release()':
sensorOpenNI.cpp:(.text._ZN6openni13VideoFrameRef7releaseEv[openni::VideoFrameRef::release()]+0x18): undefined reference tooniFrameRelease'
/tmp/ccrPQHEg.o: In function openni::VideoFrameRef::_setFrame(OniFrame*)':
sensorOpenNI.cpp:(.text._ZN6openni13VideoFrameRef9_setFrameEP8OniFrame[openni::VideoFrameRef::_setFrame(OniFrame*)]+0x25): undefined reference tooniFrameAddRef'
/tmp/ccrPQHEg.o: In function nite::UserTrackerFrameRef::release()':
sensorOpenNI.cpp:(.text._ZN4nite19UserTrackerFrameRef7releaseEv[nite::UserTrackerFrameRef::release()]+0x24): undefined reference toniteUserTrackerFrameRelease'
/tmp/ccrPQHEg.o: In function nite::UserTracker::create(openni::Device*)':
sensorOpenNI.cpp:(.text._ZN4nite11UserTracker6createEPN6openni6DeviceE[nite::UserTracker::create(openni::Device*)]+0x13): undefined reference toniteInitializeUserTracker'
sensorOpenNI.cpp:(.text._ZN4nite11UserTracker6createEPN6openni6DeviceE[nite::UserTracker::create(openni::Device*)]+0x27): undefined reference to niteInitializeUserTrackerByDevice'
/tmp/ccrPQHEg.o: In functionnite::UserTracker::destroy()':
sensorOpenNI.cpp:(.text._ZN4nite11UserTracker7destroyEv[nite::UserTracker::destroy()]+0x1e): undefined reference to niteShutdownUserTracker'
/tmp/ccrPQHEg.o: In functionnite::UserTracker::readFrame(nite::UserTrackerFrameRef*)':
sensorOpenNI.cpp:(.text._ZN4nite11UserTracker9readFrameEPNS_19UserTrackerFrameRefE[nite::UserTracker::readFrame(nite::UserTrackerFrameRef*)]+0x1d): undefined reference to niteReadUserTrackerFrame'
/tmp/ccrPQHEg.o: In functionnite::UserTracker::startSkeletonTracking(short)':
sensorOpenNI.cpp:(.text._ZN4nite11UserTracker21startSkeletonTrackingEs[nite::UserTracker::startSkeletonTracking(short)]+0x1e): undefined reference to niteStartSkeletonTracking'
/tmp/ccrPQHEg.o: In functionnite::NiTE::initialize()':
sensorOpenNI.cpp:(.text._ZN4nite4NiTE10initializeEv[nite::NiTE::initialize()]+0x7): undefined reference to niteInitialize'
collect2: ld returned 1 exit status
patrick#ubuntu:~/Koerpersteuerung$ g++ -c sensorOpenNI.cpp sensorOpenNI.hpp -I Include/
patrick#ubuntu:~/Koerpersteuerung$ g++ mainSensor.cpp sensorOpenNI.o -I Include/
sensorOpenNI.o: In functionopenni::VideoFrameRef::release()':
sensorOpenNI.cpp:(.text._ZN6openni13VideoFrameRef7releaseEv[openni::VideoFrameRef::release()]+0x18): undefined reference to oniFrameRelease'
sensorOpenNI.o: In functionopenni::VideoFrameRef::_setFrame(OniFrame*)':
sensorOpenNI.cpp:(.text._ZN6openni13VideoFrameRef9_setFrameEP8OniFrame[openni::VideoFrameRef::_setFrame(OniFrame*)]+0x25): undefined reference to oniFrameAddRef'
sensorOpenNI.o: In functionnite::UserTrackerFrameRef::release()':
sensorOpenNI.cpp:(.text._ZN4nite19UserTrackerFrameRef7releaseEv[nite::UserTrackerFrameRef::release()]+0x24): undefined reference to niteUserTrackerFrameRelease'
sensorOpenNI.o: In functionnite::UserTracker::create(openni::Device*)':
sensorOpenNI.cpp:(.text._ZN4nite11UserTracker6createEPN6openni6DeviceE[nite::UserTracker::create(openni::Device*)]+0x13): undefined reference to niteInitializeUserTracker'
sensorOpenNI.cpp:(.text._ZN4nite11UserTracker6createEPN6openni6DeviceE[nite::UserTracker::create(openni::Device*)]+0x27): undefined reference toniteInitializeUserTrackerByDevice'
sensorOpenNI.o: In function nite::UserTracker::destroy()':
sensorOpenNI.cpp:(.text._ZN4nite11UserTracker7destroyEv[nite::UserTracker::destroy()]+0x1e): undefined reference toniteShutdownUserTracker'
sensorOpenNI.o: In function nite::UserTracker::readFrame(nite::UserTrackerFrameRef*)':
sensorOpenNI.cpp:(.text._ZN4nite11UserTracker9readFrameEPNS_19UserTrackerFrameRefE[nite::UserTracker::readFrame(nite::UserTrackerFrameRef*)]+0x1d): undefined reference toniteReadUserTrackerFrame'
sensorOpenNI.o: In function nite::UserTracker::startSkeletonTracking(short)':
sensorOpenNI.cpp:(.text._ZN4nite11UserTracker21startSkeletonTrackingEs[nite::UserTracker::startSkeletonTracking(short)]+0x1e): undefined reference toniteStartSkeletonTracking'
sensorOpenNI.o: In function nite::NiTE::initialize()':
sensorOpenNI.cpp:(.text._ZN4nite4NiTE10initializeEv[nite::NiTE::initialize()]+0x7): undefined reference toniteInitialize'
collect2: ld returned 1 exit status
I'm calling g++ like this:
g++ -o test mainSensor.cpp sensorOpenNI.cpp -I Include/
Try copying the libraries libOpenNI2.so and libNiTE2 like that:
sudo cp ./OpenNI-Linux-x86-2.2/Redist/libOpenNI2.so /usr/local/lib
sudo cp ./NiTE-Linux-x86-2.2/Redist/libNiTE2.so /usr/local/lib
then do
sudo ldconfig
and now compile the program by adding -lOpenNI2 -lNiTE2