How to link QCA to my Qt project? - c++

I have successfully cloned git repository of QCA and built it using
cmake .
make
sudo make install
This created bin directory with some executables and I can confirm everything works as should by running
$ bin/qcatool-qt5 plugins
/usr/lib/x86_64-linux-gnu/qt5/plugins
/home/metheuser/qtcreator/qca/bin
Available Providers:
qca-gnupg
qca-logger
qca-ossl
This product includes cryptographic software written by Eric Young
(eay#cryptsoft.com)
qca-softstore
However when I specify in my Qt project:
QT += crypto
I get this error
Unknown module(s) in QT: crypto
I have no idea how to include the library now. I have tried adding this to my .pro file:
LIBS += -lqca
and
LIBS += -lqca2
Both resulting in error:
cannot find -lqca
What should I do? I followed the official README/INSTALL instructions.

you need to add the lib path to your .pro file. So, Instead of
LIBS += -lqca
you need
LIBS += -L$${PATH_QCA_LIB} -lqca

Related

Bind Qt with QtGStreamer

I am trying to make a simple qt c++ VoIP application, when I searched I found the QtGStreamer Lib and wanted to make it work. I download the latest version 1.2 from here.When I went to the example folder and tried to compile the VoIP example I got this error:
Qt5GStreamer-1.0 development package not found
What I try is comment this line CONFIG += link_pkgconfig in .pro file and add the src folder that came with the folder of QtGstreamer to folder project. I also added this to .pro file INCLUDEPATH += $$PWD/src this the path of the Libs folder
Now I get an error that i need to add boost Lib so I add it by adding this to .pro file
INCLUDEPATH += C:/boost_1_61_0
LIBS += "-LC:/boost_1_61_0/stage/lib"
Now I get many errors that say (undefined reference to ..) 130 error. Not sure what to try.
the file comes with containing Readme file I download the dependency but the same error I think the problem that I don't link it correctly I'm still a beginner in 3rd party and link libs in c++,
my os is windows
Thanks in advance

Fail to link Pylon(Basler) SDK with Qt on Mac

I am trying to link Qt with the Pylon camera SDK in a Qt Creator project.
I install the pylon Camera Software Suite app from this pylon for OS X and the pylon framework is install at /Library/Frameworks/pylon.framework.
I first follow the pylon Programmer's Guide which is installed with the app to link the pylon with Xcode. It works perfectly.
Then I try to link with my Qt Project. I add this in the .pro file:
mac: LIBS += -F/Library/Frameworks/ -framework pylon
# add GenICam because pylon Programmer's Guide do so
INCLUDEPATH += /Library/Frameworks/pylon.framework/Headers/GenICam
DEPENDPATH += /Library/Frameworks
But this doesn't work. Qt cannot find the header files.
I also try:
QMAKE_LFLAGS += -F/Library/Frameworks/
LIBS += -framework pylon
as said in the document Using Frameworks. But still not working. Anyone help me to fix this? Thanks.
Update:
Weird is that Qt can detect auto-complete of the header files but when build it says no such file found.
I just answered this here:
A) If you are compiling this Pylon framework with source then In these cases you need source code installation, you need to go to your
Pylon source directory, e.g.:
<path-to-pylon>/src/include/
You can locate the directory where PylonIncludes.h is installed by
runing the following command:
find <path-to-Pylon> -name PylonIncludes.h
Once you locate the directory e.g. lets say
/Users/kevin/Pylon5.5 then you include add the following line in your
CMAkeLists.txt
INCLUDEPATH += /Users/kevin/Pylon5.5/src/include/
B) If you have binary framework itself then you can workaround by copying all headers to tmporary location under pylon/<all-headers>
cp -rf /Library/Frameworks/pylon.framework/Versions/A/Headers/* /tmp/pylonHeaders/pylon/ Then use following in .pro file
INCLUDEPATH += /tmp/pylonHeaders
LIBS += -framework pylon
There is an automatism in Xcode when you insert a framework it includes the header directory of the used frameworks automatically.
In your case, simple add this line and the compiler will find the pylon headers.
QMAKE_CXXFLAGS += -F/Library/Frameworks
I hope this will help you. With best regards

How add Boost Library to QTCreator on RPI2?

I need the boost library for a project on my Raspberry Pi 2. I use QTCreator for coding but I cant add the Library. I tried to add this to the .pro file of my project in QTCreator:
LIBS += -L/usr/include/boost -lboost_chrono
I installed the boost Library using:
sudo apt-get install libboost1.55-all
If I try to compile my code I get the "boost/chrono.hpp no such file or directory".
I read somewhere that I have to compile the Library first using the same compiler as QtCreator (usually mingw) but I have no clue how to do that.(Im a beginner with the raspberry and the linux system in general)
Thx for your help
LIBS += -L
This adds a path to the linker. Your error is related to a path in the include. You should add the boost path via
INCLUDEPATH +=
As mentioned here: How to add include path in Qt Creator?

How to create Qt executable for linux machines

I have created a project using Qt 5.3. I want this project to be executable on other linux machines, so I took the executable file which is generated in the build folder of the project and executed it on the other linux machine. When I did that I got the following error:
./Project_name: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
I developed the application using QT 5.3 but the linux machine where I am trying to execute it has libqt4 libraries. Is there any way for this file to be executable using the libqt4 libraries only.The following is my .pro file of the project:
#-------------------------------------------------
#
# Project created by QtCreator 2014-12-08T09:19:31
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Project_name
TEMPLATE = app
QMAKE_CXXFLAGS += -std=c++11
SOURCES += main.cpp\
mainwindow.cpp \
INCLUDEPATH += /usr/include/python2.7/
HEADERS += mainwindow.h
FORMS += mainwindow.ui
I checked online and found out that we need to make changes in the "greaterThan(QT_MAJOR_VERSION, 4): QT += widgets" so that it works for qt4 libraries. I did that but it did not work. So could you let me know what could be done so that the project which is built using libqt5 can also be executed on machines which have libqt4. Installing libqt5 libraries can be done but I am looking for a way other than that.
Is there any way for this file to be executable using the libqt4 libraries only
Not easily at least... Even if you created symlinks, Qt 4 and Qt 5 are not binary compatible.
If you want to make it self-contained:
bundle the libraries statically.
Use dynamic symbol loading and based on the version you find, you may need to program the code to act differently. But it may be a hell lot of work.
hey make sure libqt5widgets are installed on your system and you are using the correct qmake (version 5x in your case) you can installl them on debian based distro by issuing the command or via Synaptic package manager
sudo apt-get install libqt5widgets5

Installing libusb on windows for use with Qt

I'm trying to install libusb (not libusb-win32) on windows 7. I have to link it with Qt 5.0.1. Here are the problems I'm facing
In the INSTALL file in the extracted libusb folder, it tells me to cd to the current folder then run
./configure
make
makeinstall
But I got the error
'./configure' is not recognized as a valid command.
Googling this problem usually gives the solution as installing libusb-win32. However, I want to avoid that, as of now.
In the libusb library, there were a few MSVC projects, so I built them. That did generated some .lib files. So I proceeded to link them with my Qt project. It recognizes the libusb.h header file but does not link properly. Here is my .pro file
QT += core gui widgets
TARGET = Qt_libusb TEMPLATE = app
SOURCES += main.cpp\
qt_libusb.cpp
HEADERS += qt_libusb.h
FORMS += qt_libusb.ui
LIBS += -LC:\libusb-1.0.18\Win32\Debug\lib\libusb-1.0
INCLUDEPATH += C:/libusb-1.0.18/libusb DEPENDPATH += C:/libusb-1.0.18/libusb
My objective is to link the libusb library with Qt. Please tell me if I haven't 'installed' the library correctly or if I am linking it in a wrong way. thanks
Your project file does not reference the library. You only provide a path where libraries might be found, but there's no reference to the libusb library itself.
What you're missing is something like
LIBS += -llibusb
You also can't have multiple project file statements on the same line. The below is an error:
TARGET = Qt_libusb TEMPLATE = app
It should look like:
TARGET = Qt_libusb
TEMPLATE = app