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.
Related
I have a Qt 5.12 Windows app. I'm using Qt Creator and Mingw 64 bit.
I've deployed the app by windeployqt.exe. When I start it, the app requires the libgcc_s_seh-1.dll file. After I paste it in the dir, I get the 0xc000007b error. I ran Dependency Walker and it gives me the following errors:
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Error: A circular dependency was detected.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
This is my .pro file
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Control
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
QMAKE_LFLAGS += -static-libgcc
##CONFIG += c++11
##QMAKE_CXXFLAGS += -std=c++0x
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
Can someone help me? Thank you very much.
I had a similar problem in the past, but I am not pretty sure if it's the same reason because I was compiling with MVSC.
In my case, the application internally links with x86 dependency files. I did download and install x64 dependency files and link with x64 files.
Anyway, the old version of Dependency Walker doesn't know to skip 32-bit DLLs in PATH when processing a 64-bit EXE or DLL the way Windows does, so some errors are not really relevant. You may find more information in this post.
If the problem remains, try to avoid the usage of a static version of libgcc, acording to this post. It is not designed to be statically linked.
...
#QMAKE_LFLAGS += -static-libgcc
...
I got that error when the compiled app could not see the Qt dlls, so check your path. It could also be that it cannot find other gcc dll, like libwinpthread-1.dll.
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 have to use a library under Linux. It's a .so compiled with gcc.
I added on my .pro :
INCLUDEPATH += mypath/include
LIBS += -L/mypath/lib/ -lmyLib
but, i get the following error :
undefined reference to `init_glove(char*, char*)'
I don't understand why i get this message. My library is linked and the header file is founded. I read that it could be a problem between the compiler used for my library, and the one used by Qt, but both seem to be gcc, so...
Any ideas ?
If the problem was the g++/gcc issue, then in your QT project simply do this
extern "C"
{
#include "mylib.h"
}
Actually, Qt was compiling with g++, so I had to change de compiler of my library : switching it from gcc to g++.
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
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.