Integrating Qt and Pylon (Basler camera software)
-
https://ibb.co/qJWp59T (image of error).
https://ibb.co/LrqhvLy (.pro file).I believe I have imported the libraries correctly as it auto populates Pylon #include headers files.
I am getting the error message at the bottom of the screen when I try to build the program (using a Grab sample code provided by Basler).
I am new to C++ so I am not sure if this is the correct way to set up the .pro file. Any advice would be extremely helpful.
-
Hi @colinodowd,
you can use the search function in this forum, and you will find e.g. https://forum.qt.io/topic/100894/integrating-pylon-into-qt-application
It seems you need MSVC on Windows to use this library.
Regards
-
Thank you. @aha_1980
I created an MSVC kit using the AMD64 compilers and Windows SDK debugger - https://ibb.co/L1K4TKB
This cleared up the earlier errors but I am now getting a linker error message on an OpenCV lib file - https://ibb.co/k9W7JG5
I used the same .pro INCLUDEPATH and LIBS on the MSVC and MinGW kit builds for OpenCV. I ran an OpenCV test code (no Pylon) on the MinGW and it compiled and displayed an image as intended.
Any help would be greatly appreciated.
-
@colinodowd is OpenCV compiled as MSVC 64 bit too?
-
I would assume so because I compiled and ran this same code (with no errors) in VS 2017
-
Hi @colinodowd,
I just saw, you are using backslashes as path separator in the .pro file.
Replace them with forward slashes, please. Especially constructs like
\b
(Backspace) will lead to surprising results.Also, make sure the path to the libs is 100% correct.
-
Same error with all back slahses replaced as forward slashes - https://ibb.co/LR8Ft7p.
I got the lib folder from this OpenCV download link: https://uptobox.com/3ep5xbddl9nn - this worked on the MinGW.
I also tried the libraries from this OpenCV download (seems to be the more standard download): https://sourceforge.net/projects/opencvlibrary/
I am now getting this error: https://ibb.co/MhzLz8p
These are the Basler libs: https://ibb.co/t22TtPp
I tried using both the Win32 and x64 versions in QT.Not sure what I am missing :/
-
Please post your
.pro
file as text. TheLIBS
lines are incorrect.The syntax is:
LIBS += -L/path/to/library -llibrary1 -llibrary2 ...
Edit: Seems you changed that in the meantime, because it was already better in earlier posts...
-
@aha_1980 - here it is:
CONFIG += c++11
SOURCES +=
main.cpp
mainwindow.cppHEADERS +=
mainwindow.hFORMS +=
mainwindow.uiINCLUDEPATH += "C:/Program Files/Basler/pylon 5/Development/include"
LIBS += -L"C:/Program Files/Basler/pylon 5/Development/lib/Win32/GCBase_MD_VC141_v3_1_Basler_pylon.lib"
LIBS += -L"C:/Program Files/Basler/pylon 5/Development/lib/Win32/GenApi_MD_VC141_v3_1_Basler_pylon.lib"
LIBS += -L"C:/Program Files/Basler/pylon 5/Development/lib/Win32/PylonBase_v5_2.lib"
LIBS += -L"C:/Program Files/Basler/pylon 5/Development/lib/Win32/PylonC.lib"
LIBS += -L"C:/Program Files/Basler/pylon 5/Development/lib/Win32/PylonGUI_v5_2.lib"
LIBS += -L"C:/Program Files/Basler/pylon 5/Development/lib/Win32/PylonUtility_v5_2.lib"INCLUDEPATH += C://Users//colin.odowd//Downloads//opencv//build//include
LIBS += -LC://Users//colin.odowd//Downloads//OpenCV-2.4.9//build-qt//lib
-lopencv_calib3d249d
-lopencv_contrib249d
-lopencv_core249d
-lopencv_features2d249d
-lopencv_flann249d
-lopencv_gpu249d
-lopencv_highgui249d
-lopencv_imgproc249d
-lopencv_legacy249d
-lopencv_ml249d
-lopencv_nonfree249d
-lopencv_objdetect249d
-lopencv_ocl249d
-lopencv_photo249d
-lopencv_stitching249d
-lopencv_superres249d
-lopencv_ts249d
-lopencv_video249d
-lopencv_videostab249d -
@aha_1980 any thoughts on this?
-
Hi @colinodowd,
your file got a bit messed up here. I'll post the relevant part edited like it should work:
INCLUDEPATH += "C:/Program Files/Basler/pylon 5/Development/include" LIBS += -L"C:/Program Files/Basler/pylon 5/Development/lib/Win32" \ -lGCBase_MD_VC141_v3_1_Basler_pylon.lib \ -lGenApi_MD_VC141_v3_1_Basler_pylon.lib \ -lPylonBase_v5_2.lib \ -lPylonC.lib \ -lPylonGUI_v5_2.lib \ -lPylonUtility_v5_2.lib INCLUDEPATH += C:/Users/colin.odowd/Downloads/opencv/build/include LIBS += -LC:/Users/colin.odowd/Downloads/OpenCV-2.4.9/build-qt/lib \ -lopencv_calib3d249d \ -lopencv_contrib249d \ -lopencv_core249d \ -lopencv_features2d249d \ -lopencv_flann249d \ -lopencv_gpu249d \ -lopencv_highgui249d \ -lopencv_imgproc249d \ -lopencv_legacy249d \ -lopencv_ml249d \ -lopencv_nonfree249d \ -lopencv_objdetect249d \ -lopencv_ocl249d \ -lopencv_photo249d \ -lopencv_stitching249d \ -lopencv_superres249d \ -lopencv_ts249d \ -lopencv_video249d \ -lopencv_videostab249d
It seems, the opencv libs are debug versions, which is marked by the trailing
d
, like "opencv_ts249d". It may therefore be, that you cannot use them with a release build program.Do you have libraries without trailing d?
Regards
-
That folder only had libs with 'd' at the end.
Where I downloaded from: https://uptobox.com/3ep5xbddl9nn - this worked on the MinGW.
Ran your refined INCLUDE and LIB in both release and debug mode and got this error message:
https://ibb.co/YQ3FY5pWhere I downloaded from: https://sourceforge.net/projects/opencvlibrary/
I then tried using a differnet OpenCV folder with a library that did not have a 'd' at the end and got this error message:
https://ibb.co/gZGrwTQ -
Does anyone know what I am doing incorrectly?
-
@colinodowd one backslash got lost in my snippet, I added it.
And once again: on Windows all libraries have to fit your compiler. You cannot use MSVC libs with MinGW or vice versa. So make sure OpenCV is compatible to what you're using.
Regards
-
@colinodowd
why do you have quotation marks around your path's? I'm not sure those are interpreted correctly -
@j-hilk said in Integrating Qt and Pylon (Basler camera software):
why do you have quotation marks around your path's? I'm not sure those are interpreted correctly
Because when you have spaces in the path, then you have to add the quotes. Otherwise it will fail to parse the path...