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

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

Related

Tesseract in QT

This is the first time I am asking a question here.
I want to use Tesseract API in QT.
My idea was to design a programme using QT that would read aloud messages (QSpeech) from Telegram Desktop version (not that important).
Tesseract came across as a tool I needed so I tried to implement it. I wanted to use its API, but finally I ended up using QProcess to call Tesseract as a programme.
HERE'S THE PROBLEM.
After including tesseract and leptonica libraries to .pro file i get this:
(.qtversion[qt_version_tag]+0x0):-1: error: undefined reference to `qt_version_tag'
How to fix it?
I use QT 5_12_3
I included the libs.
INCLUDEPATH += "/usr/include"
LIBS += -L"/usr/local/lib" -ltesseract
INCLUDEPATH += "/usr/include"
LIBS += -L"/usr/lib/x86_64-linux-gnu" -llept
I downloaded QT from the official website. Tesseract API code is an example taken from the documentation. From the same documentation I followed instructions to download everything needed. As I mentioned before, if I compile a text file with the code sample, then it works fine. I just can't integrate it into QT.
Tesseract and Leptonica create pkg-config files, so you didn't have to manually add INCLUDEPATH or LIBS to your project, instead use
QT_CONFIG -= no-pkg-config
Config *= link_pkgconfig
PKGCONFIG *= tesseract
If it doesn't work for you, check whether the Tesseract is installed correctly (also check that you have tesseract.pc file in your system).

z.lib problems while porting qt creator projet to windows

I am trying to port a Qt5.9 project from Mac to Windows 10.
I was able to compile the project easily in a ubuntu installation.
While trying to build it for windows, i had problems with finding zlib include headers with
#include<zlib.h>
That i corrected after following answers here on Stack to
#include<QtZlib/zlib.h>
Now i have problems in LINK phase, it can not open the file z.lib
Problem is i downloaded zlib packages, builds, source code and could not find a z.lib. Only different named libs. Searching in google i could only find people with the same problem, z.lib is not one of the libs included in zlib installation.
This is my project file:
TEMPLATE = app
QT += qml quick widgets websockets
CONFIG += c++11
SOURCES += \
main.cpp \
api.cpp \
app.cpp
HEADERS += \
api.hpp \
app.hpp
RESOURCES += qml.qrc
LIBS += -lz
I tried putting all possible dll and lib files in the project folder. None of them is named z.lib though.
The symbols for zlib are already part of the qt libraries. As long as you do not try to link the zlib explicitly it should work. At least it does work for me.
add to your project file:
!win32 {
LIBS += -lz
}
I managed to solve my problem updating my Qt installation to use MinGw 5.3 32bit. I was using VisualStudio 2015 as the compiler before.
Only changing the compiler to MinGw (g++) 5.3 made everything work with the same pro file i posted in the original question. Thanks everybody who tried to help!

How to link QCA to my Qt project?

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

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

Qt will not link anything

I have tried this both on Ubuntu Linux and on Windows. I can not get Qt to link any of its libraries or any external libraries, I have tried just about every LIBS += -Lpath/to/lib -llib and INCLUDEPATH += path/to/include/files combination possible in my .pro file:
QT += opengl
TARGET = QtOpenGLExample
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
GLExampleWidget.cpp
HEADERS += GLWidget.h
LIBS += -L /usr/lib/ -llibQtOpenGL.so.4.6.2
I noticed this being a problem when I clicked "Open GL" in the project creator and it did not work then (even after I tried messing around in the .pro), before I just thought I was doing something stupid when I tried to link SFML 1.6.
P.s Does it have to do with were my project is located?:
/home/aperson/Projects/ComputerProgramming/C++/OpenGLExample/
It should not be
LIBS += -L /usr/lib/ -llibQtOpenGL.so.4.6.2
but
LIBS += -L /usr/lib/ -lQtOpenGL
Because for the linker -lfoo means libfoo.so (and it should be able to find the right version of the file, so you don't need to tell about 4.6.2)
Probably, you don't even need a special LIBS since opengl is mentioned in the QTline. But you should be sure that the libqt4-opengl-dev package is installed.
Taken from QtOpenGL Module :
The Qt OpenGL module makes it easy to use OpenGL in Qt applications. It provides an OpenGL widget class that can be used just like any other Qt widget, except that it opens an OpenGL display buffer where you can use the OpenGL API to render the contents.
To include the definitions of the module's classes, use the following directive:
#include <QtOpenGL>
To link against the module, add this line to your qmake .pro file:
QT += opengl
You might need to link to your opengl library. This should do :
LIBS += -lGL
It is because you have told qmake that you are creating a console application in your .pro file making it ignore all the GUI libraries. So get rid of the CONFIG += console line.
The project file you have seems OK. QMake should generate the corrent -l -L command for you. IMHO that is not the problem.
Are you missing the opengl/Qt4 package? Its called libqt4-opengl-dev on Ubuntu and Debian.
See
http://packages.debian.org/sid/libqt4-opengl-dev
http://packages.ubuntu.com/search?searchon=names&keywords=libqt4-opengl-dev
Type this on your shell to check and install the package if needed.
$ dpkg -l | grep opengl
ii libqt4-opengl 4:4.8.0-1ubuntu11 Qt 4 OpenGL module
$ aptitude install libqt4-opengl-dev