I downloaded qt a while ago and have just now recently started playing around with QT creator.
I am trying to get Opencv integrated using pkg-config.
The pro file is:
QT += core gui
TARGET = QTTest
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
unix: CONFIG+=link_pkgconfig
unix: PKGCONFIG+=opencv
I have tried including two different ways and tried .
I'm trying to simply run the following
cv::Mat* mat;
and it gives me 2 errors:
symbol(s) not found for architecture x86_64
collect2: id returned 1 exit status
It also gives me a warning.
warning "This version of Mac OSX is unsupported."
Can anyone help or enlighten me on what to do for fixing this. Any help is greatly appreciated. :-D
The symbol(s) not found error means you haven't linked the libraries accessed by the code.
The osx warning is because you're probably using a linux distribution, in which case the libraries will have the .so extension, not .dylib.
Unfortunately I can't test on linux at the moment.
Try to follow a Linux tutorial, there should be plenty out there
Your problem must be that you have an undefined yet declared slot. (That is an action callback function on a widget. Maybe you accidentally created in the designer a click callback function of a button.)
My error msg was the same and here I have found an answer: Qt & C++: Error: symbol(s) not found for architecture x86_64, collect2: ld returned 1 exit status
Related
I have built Qt 5 libs from source into Ubuntu 12.04 and made a Qt test app. In .pro file I have written QT += core gui webkitwidgets to use Qwebview in my test project.
But when I run qmake into Qt creator then it gives me error:
Unknown module(s) in QT: webkitwidgets
I think webkit or webkitwidgets module is not build by source when I built Qt 5 libs from source.
So I have build qtwebkit or webkitwdgtes module from source as per below.
cd qtwebkit
qmake
make -jX
where X is number of cores * 2 + 1
But when I run make command then I got below errors.
StringImpl.cpp:(.text+0x64ad): undefined reference to u_strToUpper_51'
StringImpl.cpp:(.text+0x6636): undefined reference to u_toupper_51'
DatePrototype.cpp:(.text+0x328): undefined reference to udat_open_51'
DatePrototype.cpp:(.text+0x366): undefined reference to udat_close_51'
JSGlobalObjectFunctions.cpp:(.text+0x99f): undefined reference tou_charType_51'
StringImpl.cpp:(.text+0xa00): undefined reference tou_foldCase_51'
CollatorICU.cpp:(.text+0x1f1): undefined reference to ucol_getLocaleByType_51' CollatorICU.cpp:(.text+0x20f): undefined reference toucol_getAttribute_51'
CollatorICU.cpp:(.text+0x25b): undefined reference to ucol_open_51'
CollatorICU.cpp:(.text+0x27f): undefined reference toucol_open_51'
CollatorICU.cpp:(.text+0x2a4): undefined reference to ucol_setAttribute_51'
and many more such undefined reference errors.
Also I have found that qtwebkit module uses ICU library (which are missing at my machine).
So how can I build ICU libraries into Ubuntu so that qtwebkit module can take reference of complied ICU libraries and I can able to fix these reference error and build qtwebkit successfully.
I have fixed a similar error by removing ICU libraries from Qt/lib folder.
If there is another version of ICU installed to os libs, it makes conflict.
Did you try this?:
sudo apt-get install libqt5webkit5-qmlwebkitplugin libqt5webkit5.
RESOURCES += \
resources.qrc
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets webkit webkitwidgets
However, and even when I made it work for my project, webkit gives more issues down the road, like being missing from the UI toolbar or not compiling at the time to publish your programme to the Store. I would suggest to look into alternative solutions like
QWebEngineView.
Try installing the package with apt-get:
sudo apt-get install libqt5webkit5-dev
I am cross-compiling a Qt Application. My host is a Ubuntu system and target is ARM board with buildroot based filesystem and I am using Qt 5.3.1. When I try to run make, I get the following error:
/home/hamzah/vibrante/toolchains/tegra-4.8.1-nv/usr/bin/armv7a-vfpv3-cortex_a15-linux-gnueabi/../../libexec/armv7a-vfpv3-cortex_a15-linux-gnueabi/gcc/arm-cortex_a15-linux-gnueabi/4.8.1/ld: cannot find /lib/libpthread.so.0
/home/hamzah/vibrante/toolchains/tegra-4.8.1-nv/usr/bin/armv7a-vfpv3-cortex_a15-linux-gnueabi/../../libexec/armv7a-vfpv3-cortex_a15-linux-gnueabi/gcc/arm-cortex_a15-linux-gnueabi/4.8.1/ld: cannot find /usr/lib/libpthread_nonshared.a
collect2: error: ld returned 1 exit status
As you can see, it is using absolute path in target for libpthread.so.0 and libpthread_nonshared.a. This library is placed in the target filesystem hosted on my host. The target library search path has been added in qmake.conf using QMAKE_LIBDIR variable:
QMAKE_LIBDIR += /home/hamzah/buildroot/output/host/usr/arm-buildroot-linux-gnueabihf/sysroot
QMAKE_LIBDIR += /home/hamzah/buildroot/output/host/usr/arm-buildroot-linux-gueabihf/sysroot/usr/lib
I need to know how to make the ld able to find this library using sysroot variable or any other approach.
PS: I am compiling Qt Application. Pre-built Qt applications are running on both my host and target
Use the qmake built by Buildroot in output/host/usr/bin. This one has the right paths pre-configured. If it still doesn't work, please submit a bug report in the Buildroot bug tracker, with a simple test case to reproduce the problem, as well as the list of steps to reproduce it.
This topic is related with following link . Temporarily I solved problem with headers: I just modified all include paths. When I try to call some dbus function, for example dbus_error_init(&err); I get a linker error: undefined reference to 'dbus_error_init'. libdbus-1.so is placed in /usr/lib/x86_64-linux-gnu so I added to pro file (I use Qt Creator) following line:
LIBS += -L/usr/lib/x86_64-linux-gnu -llibdbus-1
but I get follwoing info: cannot find -llibdbus-1 How to fix that ?
Usually it's just -ldbus-1 or -ldbus. You can also try adding CONFIG += dbus in your .pro file to enable the Qt DBUS classes, which if I remember rightly detects the DBUS library as well, as long as Qt was built with support for it.
Sorry for repeating a frequent question.
It is now a week that I am trying to set up openCV with Qt 5.0.2 or Microsoft VC++ express edition in my 32bit windows 7, with no success.
now for QT :
-It is QT 5.0.2 MinGW .
-It runs programs not using opencv successfully.
Now, the opencv lines of my .pro file is like this :
INCLUDEPATH += "C:\opencv\build\include"
LIBS += "C:\opencv\bin\bin\libopencv_core243.dll"
LIBS += "C:\opencv\bin\bin\libopencv_highgui243.dll"
This is because code like bellow results in error "not finding core.hpp":
LIBS += -LC:\\opencv\\build\\x86\\vc10\\lib\
libopencv_core243 \
libopencv_highgui243 \
Now its autocomplete for opencv functions runs, and if you write :
cv::Mat im = cv::imread("D:\\Tulips.jpg");
there is no error.
But if after this you write :
cv::imshow("im",im);
It closes the program with exception code : c0000005
It even doesn't fall in "catch" of an exception handler.
The strange thing is that VC++ express is doing just the same.
I should mention that I have compiled opencv for MinGW myself, and the build was Ok because it works with Code::Blocks.
I used prebuilt opencv with my VC++ 10 , but that doesn't work either.
Pleaase help me!Thanks a lot!
Check if im.data is not null. Because c0000005 is access violation, that means you are using some invalid pointers, so show some more code or a better solution is to use a debugger and step-trough your code.
I finally found my answer !!
It was all ablut the firewall.
My fireWall blocked the process and opencv couldn't access the memory.
When I used cvLoadImage() , it worked, but cv::imread() didn't.
I had added an exception for visual satudio but it seems that wasn't enough. Now my firewall is off and FINALLY EVERYTHING IS OKKK :) :)
I am developing a Windows (7) application using Qt (4.7.0) to call some methods in a DLL (NI visa32.dll) to communicate with instruments through the GPIB port. The manufacturer's header file is also available (visa.h).
In the project file, I tried adding the path and library reference to the original places where the files are located at as:
INCLUDEPATH += "C:/Program Files/National Instruments/Shared/CVI/Include"
LIBS += "C:/Windows/System32/visa32.dll"
but, I get the compilation error:
collect2: ld returned 1 exit status
Following the instructions in Importing a DLL into Qt, I created a "visa.a" from the "visa32.dll", and copied them to a subfolder "visa/lib", and added the path and library to the project file:
INCLUDEPATH += visa/include
LIBS += -Lvisa/lib
LIBS += -lvisa.a
I tried also with -lvisa or -lvisa.dll, but in all the cases I get also another compilation error saying that the -lvisa, -lvisa.a or -lvisa.dll is not found. I edited the original header file "visa.h", and prefixed with Q_DECL_IMPORT every object in the file, and also made sure that the extern "C" statement be present.
I include the reference to the header file in the application as:
#include "visa.h"
and note that the compiler does recognize the referenced objects belonging to the visa.h file.
Any help to solve this compilation error will be greatly appreciated.
I also tried with Visual C++ (2010) following the instructions of DLL References in Visual C++. In this case, I do not get any compilation error, but linking errors. For example:
AgiE364X.obj: error LNK2019: unresolved external symbol
"extern "C" long __stdcall viClose(unsigned long)"
being viClose a called method in NI-VISA.
I would prefer to use Qt C++ instead of Visual C++, though.
Thanks in advance.
I'm not sure since I'm new to Qt myself but here are some guesses: I noticed you have a space in INCLUDEPATH string. Also, LIBS += -Lvisa/lib has a capitol L (is this correct?). I'm not saying this is your problem but perhaps worth a try. The last thing that comes to mind is that if you're using Qt Creator only partially type #include "visa.h" and see if auto complete can complete it for you. If it can, than prob the rest is OK. Trigger auto-complete with Ctrl+Space. I've noticed that when I mess up the paths auto-complete is a good gauge for this sort of thing.
There are two types of library of VISA provided by NI: the one is compiled by borland c++, the other is compiled by microsoft vc++.
As for Qt, you can use Qt which should be compiled by MSVC, to link the visa32.lib which is compiled by MSVC too. And it MUST link .lib instead of .dll, The MSVC library of VISA is in "C:\Program Files\IVI Foundation\VISA\WinNT\lib\msc" by default.
The include directory is C:\Program Files\IVI Foundation\VISA\WinNT\include by default.
In fact, the above information can be known from VISA example after you install the device driver.