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

点点圈 提交于 2019-12-11 03:44:16

问题


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.


回答1:


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



回答2:


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



来源:https://stackoverflow.com/questions/39421854/fail-to-link-pylonbasler-sdk-with-qt-on-mac

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!