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.
Related
I am trying to install the Trans-Proteomic Pipeline found here. I have installed each of the necessary libraries mentioned in the readme, but when I run make all or make install it progresses through much of the compilation, and then errors out with the following message:
undefined reference to `boost::iostreams::zlib::deflated'
The error log is much longer with what seems to be redundant information but it generally looks like this:
/usr/bin/ld: /home/nkho/proj/tpp/release_6-0-0/build/gnu-x86_64-rc28/lib/libpwiz.a(MSDataFile.o): in function `pwiz::msdata::(anonymous namespace)::openFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)':
MSDataFile.cpp:(.text+0x1cda): undefined reference to `boost::iostreams::zlib::deflated'
/usr/bin/ld: MSDataFile.cpp:(.text+0x1cf8): undefined reference to `boost::iostreams::zlib::default_strategy'
/usr/bin/ld: /home/nkho/proj/tpp/release_6-0-0/build/gnu-x86_64-rc28/lib/libpwiz.a(MSDataFile.o): in function `boost::detail::sp_counted_impl_p<boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_compressor_impl<std::allocator<char> >, std::allocator<char> >::impl>::dispose()':
MSDataFile.cpp:(.text._ZN5boost6detail17sp_counted_impl_pINS_9iostreams16symmetric_filterINS2_6detail20zlib_compressor_implISaIcEEES6_E4implEE7disposeEv[_ZN5boost6detail17sp_counted_impl_pINS_9iostreams16symmetric_filterINS2_6detail20zlib_compressor_implISaIcEEES6_E4implEE7disposeEv]+0x27): undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost6detail17sp_counted_impl_pINS_9iostreams16symmetric_filterINS2_6detail20zlib_compressor_implISaIcEEES6_E4implEE7disposeEv[_ZN5boost6detail17sp_counted_impl_pINS_9iostreams16symmetric_filterINS2_6detail20zlib_compressor_implISaIcEEES6_E4implEE7disposeEv]+0x2f): undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()'
/usr/bin/ld: /home/nkho/proj/tpp/release_6-0-0/build/gnu-x86_64-rc28/lib/libpwiz.a(MSDataFile.o): in function `boost::iostreams::basic_gzip_compressor<std::allocator<char> >::basic_gzip_compressor(boost::iostreams::gzip_params const&, int)':
MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0x1d7): undefined reference to `boost::iostreams::detail::zlib_base::zlib_base()'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0x1f9): undefined reference to `boost::iostreams::detail::zlib_base::do_init(boost::iostreams::zlib_params const&, bool, void* (*)(void*, unsigned int, unsigned int), void (*)(void*, void*), void*)'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0x337): undefined reference to `boost::iostreams::zlib::best_compression'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0x34e): undefined reference to `boost::iostreams::zlib::best_speed'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0xa51): undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0xa59): undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0xa75): undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0xa7d): undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()'
I've seen a variety of other questions with similar messages that mention one should define the path to the boost installation/binaries in the g++ command, but all I am running is make install, so I am not sure where I would specify this.
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?
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 to write a c++ application that requires access to a MySQL database.
Until I updated the MySQL version from 5.7 to 8.0 I could use the framework provided here and suggested in this StackOverflow post
Since the MySQL upgrade, I get the following linker errors:
/usr/bin/ld: warning: libmysqlclient.so.18, needed by /usr/lib/libmysqlpp.so, not found (try using -rpath or -rpath-link)`mysql_num_fields#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_options#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_fetch_lengths#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_close#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_field_count#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_error#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_select_db#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_next_result#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_real_connect#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_get_server_info#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_fetch_row#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_init#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_get_client_info#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_thread_init#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_fetch_field#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_thread_id#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_get_proto_info#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_thread_end#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_info#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_kill#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_get_host_info#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_more_results#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_insert_id#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_ping#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_errno#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_use_result#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_free_result#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_store_result#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_set_server_option#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_real_query#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_affected_rows#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_num_rows#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_field_seek#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_real_escape_string#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_escape_string#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_ssl_set#libmysqlclient_18'
/usr/bin/ld: /usr/lib/libmysqlpp.so: undefined reference to `mysql_stat#libmysqlclient_18'
Any help on fixing the current issue or recommendation of a c++ MySQL framework that will work with MySQL version >= 8.0 will be greatly appreciated.
I'm using Ubuntu and tried using synaptic to install everything that had the word "GLUT" in it and also SDL and opengl . But still a simple program fails to compile . It shows this :
opengl1.cpp:(.text+0xe): undefined reference to `glClear'
opengl1.cpp:(.text+0x1a): undefined reference to `glBegin'
opengl1.cpp:(.text+0x2e): undefined reference to `glVertex2i'
opengl1.cpp:(.text+0x33): undefined reference to `glEnd'
opengl1.cpp:(.text+0x38): undefined reference to `glFlush'
/tmp/ccnwQeLu.o: In function `MyInit()':
opengl1.cpp:(.text+0x4c): undefined reference to `glGetString'
opengl1.cpp:(.text+0x57): undefined reference to `std::cout'
opengl1.cpp:(.text+0x5c): undefined reference to `std::basic_ostream >& std::operator >(std::basic_ostream >&, unsigned char const*)'
opengl1.cpp:(.text+0x6c): undefined reference to `std::basic_ostream >& std::operator >(std::basic_ostream >&, char const*)'
opengl1.cpp:(.text+0x78): undefined reference to `glGetString'
opengl1.cpp:(.text+0x83): undefined reference to `std::cout'
opengl1.cpp:(.text+0x88): undefined reference to `std::basic_ostream >& std::operator >(std::basic_ostream >&, unsigned char const*)'
opengl1.cpp:(.text+0x98): undefined reference to `std::basic_ostream >& std::operator >(std::basic_ostream >&, char const*)'
opengl1.cpp:(.text+0xc0): undefined reference to `glClearColor'
opengl1.cpp:(.text+0xdf): undefined reference to `glColor3f'
opengl1.cpp:(.text+0xec): undefined reference to `glPointSize'
opengl1.cpp:(.text+0xf8): undefined reference to `glMatrixMode'
opengl1.cpp:(.text+0xfd): undefined reference to `glLoadIdentity'
opengl1.cpp:(.text+0x12d): undefined reference to `gluOrtho2D'
/tmp/ccnwQeLu.o: In function `main':
opengl1.cpp:(.text+0x14a): undefined reference to `glutInit'
opengl1.cpp:(.text+0x156): undefined reference to `glutInitDisplayMode'
opengl1.cpp:(.text+0x16d): undefined reference to `glutInitWindowSize'
opengl1.cpp:(.text+0x181): undefined reference to `glutInitWindowPosition'
opengl1.cpp:(.text+0x18d): undefined reference to `glutCreateWindow'
opengl1.cpp:(.text+0x19e): undefined reference to `glutDisplayFunc'
opengl1.cpp:(.text+0x1a3): undefined reference to `glutMainLoop'
/tmp/ccnwQeLu.o: In function `__static_initialization_and_destruction_0(int, int)':
opengl1.cpp:(.text+0x1cb): undefined reference to `std::ios_base::Init::Init()'
opengl1.cpp:(.text+0x1d0): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccnwQeLu.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
If I use g++ instead of gcc I get this:
vim opebgl1.cpp
g++ opengl1.cpp -o opengl1 -lGL -lstdc++ -lc -lm
and then get this :
/tmp/ccCJBuIl.o: In function `MyInit()':
opengl1.cpp:(.text+0x12d): undefined reference to `gluOrtho2D'
/tmp/ccCJBuIl.o: In function `main':
opengl1.cpp:(.text+0x14a): undefined reference to `glutInit'
opengl1.cpp:(.text+0x156): undefined reference to `glutInitDisplayMode'
opengl1.cpp:(.text+0x16d): undefined reference to `glutInitWindowSize'
opengl1.cpp:(.text+0x181): undefined reference to `glutInitWindowPosition'
opengl1.cpp:(.text+0x18d): undefined reference to `glutCreateWindow'
opengl1.cpp:(.text+0x19e): undefined reference to `glutDisplayFunc'
opengl1.cpp:(.text+0x1a3): undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
So what do I really need to start working with opengl in Ubuntu?
Add "-lstdc++ -lGL" to your linker flags.
Or try to compile it like this:
g++ opengl1.cpp -o opengl1 -lGL -lGLU -lc -lm
(edit: added -lGLU, removed -lstdc++)
You should link it with glut and GLU as well:
g++ opengl1.cpp -o opengl1 -lGL -lstdc++ -lc -lm -lglut -lGLU
Files ended with .cpp must be compiled with g++. The rest of the errors are related to the linking process, and they should not happen if you build your application with the command I suggested above. If they do, make sure you have installed libglut and libglu.
Make sure you are using g++ to build your C++ files to avoid the linker errors pertaining to the C++ standard library.
To resolve the GLUT symbols you probably just need to add -lglut to your final build command.
While compiling the code you must mention some parameters according to your includes.
You already used -lGL, -lm etc.
To use gluOrtho2D the parameter to be used is -lGLU
and for other functions that begin with glut use -lglut