I am trying to work with a depth sensor (PMD Camboard) and trying to show the captured depth image as a live stream. I can get the data from the sensor just fine. The problem starts as soon as I try to put in the OpenCV parts. Individually they work perfectly, but the problem starts as soon as I try to integrate them. I think the error is with the CMakeLists.txt, since even if I try to compile a simple program that just displays the webcam feed, without any of the depthsensor stuff, I get the same error. The said program works when I try to compile it with just the CMake for openCV.
EDIT: I tried systematically disabling parts of the CMake to see which parts exactly trigger the error and found that the line:
link_directories(${royale_LIB_DIR})
is the one that is causing the error.
I get the following errors when I try to compile:
/usr/local/lib/libopencv_highgui.so.3.1.0: undefined reference to `QWidget::isFullScreen() const#Qt_5'
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QAbstractSlider::setMinimum(int)#Qt_5'
/usr/local/lib/libopencv_highgui.so.3.1.0: undefined reference to `non-virtual thunk to QBoxLayout::minimumSize() const#Qt_5'
/usr/lib64/libQt5OpenGL.so.5: undefined reference to `QTransform::type() const#Qt_5'
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QWidget::hasHeightForWidth() const#Qt_5'
/usr/lib64/libQt5OpenGL.so.5: undefined reference to `QPen::color() const#Qt_5'
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QFrame::changeEvent(QEvent*)#Qt_5'
/usr/lib64/libQt5OpenGL.so.5: undefined reference to `QOpenGLMultiGroupSharedResource::insert(QOpenGLContext*, QOpenGLSharedResource*)#Qt_5_PRIVATE_API'
/usr/lib64/libQt5OpenGL.so.5: undefined reference to `QPaintDevice::~QPaintDevice()#Qt_5'
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QObject::QObject(QObject*)#Qt_5'
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QTabWidget::metaObject() const#Qt_5'
/usr/local/lib/libopencv_cvv.so.3.1.0: undefined reference to `QColorDialog::QColorDialog(QWidget*)#Qt_5'
/usr/local/lib/libopencv_highgui.so.3.1.0: undefined reference to `QFutureInterfaceBase::setThreadPool(QThreadPool*)#Qt_5'
/usr/lib64/libQt5OpenGL.so.5: undefined reference to
Full error at http://pastebin.com/KLKtzzSn
And my CMakeLists.txt is as follows:
cmake_minimum_required(VERSION 2.8)
set(CMAKE_PREFIX_PATH "share")
#project (depthDataCallBack)
project (webStream)
find_package(OpenCV REQUIRED)
find_package(royale REQUIRED)
link_directories(${royale_LIB_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
add_executable(webStream webStream.cpp)
target_link_libraries(webStream ${OpenCV_LIBS})
target_link_libraries(webStream "${royale_LIBS}")
I'm new to CMake, having only been recently corrected. Any help would be appreciated.
The list of errors shows that there is not Qt5 Widgets in linkage. Add the below lines to your CMakeLists.txt:
target_link_libraries(webStream Qt5::Widgets)
target_link_libraries(webStream Qt5::Core)
The other question is whether or not Qt 5 is installed in that system.
Also read here: cmake doesn't link libGLU using QtOpenGL as long as there Qt OpenGL dependencies missing as well.
Related
I'm working on a Qt project using the Network package (in particular QTcpSocket). I can easily compile it using qmake, but I fail to do so using cmake (which I need for cross compilation), due to some undefined references regarding the Network package.
My CmakeLists contains, amongst others, the following lines (with ... being placeholders for other things):
find_package(Qt5 COMPONENTS Network REQUIRED)
qt5_use_modules(... Network ...)
target_link_libraries(... Qt5::Network ...)
I thought those are all that is required, but apparently not so.
The undefined reference errors I get when linking are a huge lists, so I will only show a small exempt, unless somebody requires more:
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qsslsocket_openssl.o):qsslsocket_openssl.cpp:(.text+0x139c): undefined reference to `__imp_CertCreateCertificateContext'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qsslsocket_openssl.o):qsslsocket_openssl.cpp:(.text+0x1441): undefined reference to `__imp_CertGetCertificateChain'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qsslsocket_openssl.o):qsslsocket_openssl.cpp:(.text+0x14c2): undefined reference to `__imp_CertFreeCertificateChain'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qsslsocket_openssl.o):qsslsocket_openssl.cpp:(.text+0x14cb): undefined reference to `__imp_CertFreeCertificateContext'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qnetworkinterface_win.o):qnetworkinterface_win.cpp:(.text+0x15): undefined reference to `ConvertInterfaceNameToLuidW'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qnetworkinterface_win.o):qnetworkinterface_win.cpp:(.text+0x2e): undefined reference to `ConvertInterfaceLuidToIndex'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qnetworkinterface_win.o):qnetworkinterface_win.cpp:(.text+0x5b): undefined reference to `ConvertInterfaceIndexToLuid'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qnetworkinterface_win.o):qnetworkinterface_win.cpp:(.text+0x75): undefined reference to `ConvertInterfaceLuidToNameW'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qnetworkinterface_win.o):qnetworkinterface_win.cpp:(.text+0xec): undefined reference to `GetNetworkParams'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qnetworkinterface_win.o):qnetworkinterface_win.cpp:(.text+0x1cd): undefined reference to `GetNetworkParams'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qnetworkinterface_win.o):qnetworkinterface_win.cpp:(.text+0x243): undefined reference to `GetAdaptersAddresses'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qnetworkinterface_win.o):qnetworkinterface_win.cpp:(.text+0x3c4): undefined reference to `ConvertInterfaceLuidToNameW'
/opt/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/libQt5Network.a(qnetworkinterface_win.o):qnetworkinterface_win.cpp:(.text+0x91e): undefined reference to `GetAdaptersAddresses'
What did I miss? Are there some other modules I have to add? Is this problem related to me cross compiling using MXE (I didn't tag it as such for now)?
So far I found MXE - Undefined reference to Qt when cross compiling with cmake and mingw, which makes it seem like MXE might be the problem, but that one is not answered.
Qt's cmake module's dependencies must be messed up. You can manually link with Iphlpapi. Add target_link_libraries(... Iphlpapi) to the CMakeFile.txt and try linking again. You can easily find the necessary libraries by googling the name of the symbol. That will bring up the relevant MSDN page. When you scroll to the bottom, you'll see what library file needs to be linked to make that API available to your program.
The explicit link directive will be a no-op when the library is properly referenced by Qt's cmake module(s). You can also make this linking conditional on the target being Windows:
if (WIN32)
target_link_libraries (mytarget Iphlpapi)
endif ()
I installed librealsense from the source. It was installed and build successfully.
When I tried to run the sample project (rs-hello-realsense) I have found the build error.
/usr/local/include/librealsense2/hpp/rs_types.hpp:90: undefined reference to `rs2_get_error_message'
/usr/local/include/librealsense2/hpp/rs_types.hpp:92: undefined reference to `rs2_get_failed_function'
/usr/local/include/librealsense2/hpp/rs_types.hpp:92: undefined reference to `rs2_get_failed_function'
Same kind of error from a different type of build.
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]+0x2e): undefined reference to `rs2_get_error_message'
rs-hello-realsense.cpp:(.text._ZN3rs25errorC2EP9rs2_error[_ZN3rs25errorC5EP9rs2_error]+0x73): undefined reference to `rs2_get_failed_function'
Finally, get it. Need to add a couple of lines in CMakeList.txt.
Which linked the libraries in the project.
find_package(realsense2 2.29.0)
target_link_libraries(rs-hello-realsense ${DEPENDENCIES} ${realsense2_LIBRARY})
OR
target_link_libraries(${PROJECT_NAME} ${realsense2_LIBRARY})
Other than all other properties of CMake File will be same
I am trying to install OpenCv3.3 and still getting same error.
//usr/local/lib/libgtk-3.so.0: undefined reference to `g_drive_is_removable'
//usr/local/lib/libgtk-3.so.0: undefined reference to `g_app_info_launch_default_for_uri_async'
//usr/local/lib/libgtk-3.so.0: undefined reference to `g_app_info_launch_default_for_uri_finish'
I installed all dependencies and followed this tutorial:
https://docs.opencv.org/trunk/d7/d9f/tutorial_linux_install.html
Does anyone know the solution, or can show me the way?
undefined reference to "somerhing " it means that these so's can not find the SO's where these functions are defined.
First time asking a question here so please bear with me if I'm not entirely coherent.
I've been attempting to learn how to use the OpenNI, libfreenect, and SensorKinect libraries to create some code for the kinect. However, the issue I'm running into is that I cannot seem to get the kinect setup properly so that I may actually test code and understand how everything works. The issue that has been the most problematic has been when I try to compile I receive a plethora of undefined reference errors and the compiler quits.
/tmp/ccnXAyOZ.o: In function `main':
KinectDraw.cpp:(.text+0x9a): undefined reference to `xnEnumerationErrorsAllocate'
KinectDraw.cpp:(.text+0xb6): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0xfa): undefined reference to `xnInitFromXmlFileEx'
KinectDraw.cpp:(.text+0x12a): undefined reference to `xnEnumerationErrorsToString'
KinectDraw.cpp:(.text+0x148): undefined reference to `xnEnumerationErrorsFree'
KinectDraw.cpp:(.text+0x169): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0x18a): undefined reference to `xnEnumerationErrorsFree'
KinectDraw.cpp:(.text+0x1a4): undefined reference to `xnEnumerationErrorsFree'
KinectDraw.cpp:(.text+0x1bf): undefined reference to `xnFindExistingRefNodeByType'
KinectDraw.cpp:(.text+0x1db): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0x202): undefined reference to `xnAllocateDepthMetaData'
KinectDraw.cpp:(.text+0x227): undefined reference to `xnWaitOneUpdateAll'
KinectDraw.cpp:(.text+0x243): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0x273): undefined reference to `xnGetDepthMetaData'
KinectDraw.cpp:(.text+0x2fe): undefined reference to `xnOSWasKeyboardHit'
KinectDraw.cpp:(.text+0x31a): undefined reference to `xnFreeDepthMetaData'
KinectDraw.cpp:(.text+0x329): undefined reference to `xnProductionNodeRelease'
KinectDraw.cpp:(.text+0x338): undefined reference to `xnProductionNodeRelease'
KinectDraw.cpp:(.text+0x347): undefined reference to `xnContextRelease'
/tmp/ccnXAyOZ.o: In function `xn::NodeWrapper::SetHandle(XnInternalNodeData*)':
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x39): undefined reference to `xnGetRefContextFromNodeHandle'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x54): undefined reference to `xnContextUnregisterFromShutdown'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x60): undefined reference to `xnContextRelease'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x6f): undefined reference to `xnProductionNodeRelease'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x82): undefined reference to `xnProductionNodeAddRef'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x91): undefined reference to `xnGetRefContextFromNodeHandle'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0xb2): undefined reference to `xnContextRegisterForShutdown'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0xc1): undefined reference to `xnContextRelease'
collect2: error: ld returned 1 exit status
The command being that receives the error is g++ KinectDraw.cpp -I /usr/include/ni -I ~/KinectLibs/OpenNI/Include. I have used https://www.kdab.com/setting-up-kinect-for-programming-in-linux-part-1/ to setup the kinect. If anyone has any insight into my issue or even just a good place to start reading to figure it out I would be very appreciative. Thank you for your time and assistance!
UPDATE: Thanks to lxrec's comment, I'm fairly certain that she/he and my initial assumption were correct in that I am not linking the libraries correctly. I haven't found any documentation for Linux implementations of code that include the directories used in compiling so if anyone has insight into this I would be appreciative.
UPDATE: So I've still yet to resolve the issue (I cannot figure out how to compile the code), however thinking that my installation of OpenNI or libfreenect was bad I have resinstalled them. That however did not solve my problem. Thank you to anyone who can provide insight!
UPDATE: Below is the code that I'm having issues compiling. I haven't even tried to add anything into it yet...
#include <XnCppWrapper.h>
#include <XnStatusCodes.h>
#include <XnOS.h>
#include <math.h>
#include <XnOpenNI.h>
#include <iostream>
using namespace xn;
using namespace std;
int main()
{
cout<<"This is a test\n";
return 0;
}
OpenNI source-code should include the libs files (.so files) in its lib directory ($SOURCE_DIR/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10-$YOUR_VERSION/lib). All of these files (for me there 5 files: libnimCodecs.so, libnimMockNodes.so, libnimRecorder.so, libOpenNI.jni.so and libOpenNI.so) are being copied to /usr/lib after you run the install.sh (please follow the OpenNI build/installation instructions)
Your example code needs a -lOpenNI arg to complete the compile process. So you should compile your code like this: g++ your_code.cpp -I/usr/include/ni -lOpenNI
This might already an old question, hopefully your prob are already solved, and this answer can help someone next time.
I am migrating a project from Qt4.x to 5, I am almost finished but I am getting errors when linking libQxt.
At first I downloaded the libQxt for Qt5 & compiled it with Qt5 then included them in the project, but it didnt solve any of the undefined references, (probably because there are deprecated functions and such) so I downloaded the libQxt for Qt4 and compiled the libraries using Qt4, and it did solve many of the undefined references, but I am still getting two errors, which shouldnt because the functions the errors refer to are in the included libraries.
These are the errors:
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x82b9): undefined reference to `_imp___ZN14QxtMailMessageC1ERK10QByteArray'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaebc): undefined reference to `_imp___ZNK17QxtMailAttachment7rawDataEv'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\csnmailbox.o: bad reloc address 0x1 in section `.text$_ZN16AttachmentsModelD1Ev[__ZN16AttachmentsModelD1Ev]'
collect2.exe: error: ld returned 1 exit status
And these are the linkings to the libraries:
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtCore.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtDesignerPlugins.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtGui.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtNetwork.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtSql.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtWeb.a" \
If I comment the line that includes the libQxtnetwork (which is the one that the program really uses) there are more errors, so I dont understand why its not detecting those 2 functions. Here are the errors I get when I comment that line:
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x167): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x61c4): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x6227): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x62a7): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x6dac): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x73c9): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x7500): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x82b9): undefined reference to `_imp___ZN14QxtMailMessageC1ERK10QByteArray'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x85dc): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x8814): undefined reference to `_imp___ZN14QxtMailMessage14setExtraHeaderERK7QStringS2_'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x9b61): undefined reference to `_imp___ZNK14QxtMailMessage14hasExtraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x9cad): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaaff): undefined reference to `_imp___ZNK14QxtMailMessage4bodyEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xab40): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xacb6): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaeb0): undefined reference to `_imp___ZNK14QxtMailMessage10attachmentERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaebc): undefined reference to `_imp___ZNK17QxtMailAttachment7rawDataEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaee7): undefined reference to `_imp___ZN17QxtMailAttachmentD1Ev'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xafd2): undefined reference to `_imp___ZN17QxtMailAttachmentD1Ev'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xb695): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\csnmailbox.o: bad reloc address 0x1 in section `.text$_ZN16AttachmentsModelD1Ev[__ZN16AttachmentsModelD1Ev]'
I hope someone can enlighten me with some knowledge.
Thankyou very much.
EDIT: I managed to 'fix' those errors, I was missing something so simple as
#include <QxtNetwork>
(I didnt write this code, which makes porting harder than it should)
Bad thing is I have very similar errors now:
..\marssies\csnmailbox.cpp: In member function 'void CSNMailBox::onAttachmentDoubleClicked(const QModelIndex&)':
..\marssies\csnmailbox.cpp:183:46: error: 'class QxtMailAttachment' has no member named 'rawData'
_f.write(_m->attachment(_fname.toLatin1()).rawData());
..\marssies\csnmailbox.cpp: In member function 'virtual void MailWorker::run()':
..\marssies\csnmailbox.cpp:491:57: error: no matching function for call to 'QxtMailMessage::QxtMailMessage(QByteArray)'
m_nm.append(__mm = new QxtMailMessage(_m.toLatin1()));
^
I will try to solve these now, at least I got past that point.
EDIT2: I have managed to solve the first error by changing rawData() to mimeData(), it must have been deprecated. I hope the functionality stays the same.
EDIT3: Apparently the last error is just an issue with the constructor:
QxtMailMessage* __mm= new QxtMailMessage(_m.toLatin1());
The constructor accepts either a QxtMailMessage object or qstrings sender, recipient, but I think _m is the message. I will have to ask who wrote the code, because the names of the variables dont help at all.
I can say the question has been solved. Thankyou.