简体   繁体   English

无法在 Mac 上的 Qt Creator 中链接 pylon 框架

[英]Fail to link pylon framework in Qt creator on Mac

I'm trying to add the pylon framework to Qt creator on Mac.我正在尝试将 pylon 框架添加到 Mac 上的 Qt Creator。

QMAKE_LFLAGS += -F/Library/Frameworks/
LIBS += -framework pylon

This doesn't work to me.这对我不起作用。 The error is always 'pylon/PylonIncludes.h' file not found .错误始终是'pylon/PylonIncludes.h' file not found

I can specify the header path for Qt creator, eg INCLUDEPATH += /Library/Frameworks/pylon.framework/Versions/A/Headers .我可以为 Qt 创建者指定头文件路径,例如INCLUDEPATH += /Library/Frameworks/pylon.framework/Versions/A/Headers But it should be #include <PylonIncludes.h> , not #include <pylon/PylonIncludes.h> when including the head file in code.但在代码中包含头文件时,它应该是#include <PylonIncludes.h> ,而不是#include <pylon/PylonIncludes.h>

However, the API headers all use such form as #include <pylon/PylonIncludes.h> , which means I cannot specify the path of header if I want to use the existing API.但是API头都使用#include <pylon/PylonIncludes.h>这样的形式,这意味着如果我想使用现有的API,我不能指定头的路径。

Does anyone know how to add pylon framework to Qt creator?有谁知道如何将 pylon 框架添加到 Qt creator 中?

A) If you are compiling this Pylon framework with source then A)如果您正在使用源代码编译此 Pylon 框架,则

In these cases you need source code installation, you need to go to your Pylon source directory, eg:在这些情况下您需要安装源代码,您需要转到您的 Pylon 源目录,例如:

 <path-to-pylon>/src/include/

You can locate the directory where PylonIncludes.h is installed by runing the following command:您可以通过运行以下命令找到安装 PylonIncludes.h 的目录:

  find <path-to-Pylon> -name PylonIncludes.h

Once you locate the directory eg lets say /Users/kevin/Pylon5.5 then you include add the following line in your CMAkeLists.txt找到目录后,例如让我们说 /Users/kevin/Pylon5.5 然后在 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> B)如果您有二进制框架本身,那么您可以通过将所有标头复制到pylon/<all-headers>下的 tmporary 位置来解决

cp -rf /Library/Frameworks/pylon.framework/Versions/A/Headers/* /tmp/pylonHeaders/pylon/

Then use following in .pro file然后在 .pro 文件中使用以下内容

  INCLUDEPATH += /tmp/pylonHeaders
  LIBS += -framework pylon

Please see Common Settings for Building Applications with pylon in Programmer's Guide and API Reference for pylon for OS X where instructions on how to set up XCode are well described:请参阅程序员指南中使用 pylon 构建应用程序的通用设置和 OS X pylon 的 API 参考,其中详细描述了如何设置 XCode 的说明:

This section shows the most common OS X build settings for building an application using pylon and Apple Xcode.本节展示了使用 pylon 和 Apple Xcode 构建应用程序的最常见的 OS X 构建设置。 Consult the Advanced Topics section for more information, eg when a different configuration is required.有关更多信息,例如当需要不同的配置时,请参阅高级主题部分。

First add the pylon framework to your project, right-click on your project and choose Add files to "< Projectname >"... .首先将 pylon 框架添加到您的项目中,右键单击您的项目并选择Add files to "< Projectname >"... Browse to the install location of the pylon framework, typically /Library/Frameworks and choose pylon.framework , click Add button.浏览到 pylon 框架的安装位置,通常是/Library/Frameworks并选择pylon.framework ,单击Add按钮。

Add the following user-defined variable for Release and Debug configurations to your build target ( Build Settings -> User-Defined -> PYLON_LIBRARY_DIR ):将以下用于发布和调试配置的用户定义变量添加到您的构建目标(构建设置 -> 用户定义 -> PYLON_LIBRARY_DIR ):

/Library

Add the following Framework Search Paths for Release and Debug configurations to your build target ( Build Settings -> Search Paths -> Framework Search Paths ):将以下用于发布和调试配置的框架搜索路径添加到您的构建目标(构建设置 -> 搜索路径 -> 框架搜索路径):

$(PYLON_LIBRARY_DIR)/Frameworks

Add the following Header Search Paths for Release and Debug configurations to your build target ( Build Settings -> Search Paths -> Header Search Paths ):将以下用于发布和调试配置的标头搜索路径添加到您的构建目标(构建设置 -> 搜索路径 -> 标头搜索路径):

$(PYLON_LIBRARY_DIR)/Frameworks/pylon.framework/Headers/GenICam

Add the following Runpath Search Path for Release and Debug configurations to your build target ( Build Settings -> Linking -> Runpath Search Path ):将以下用于发布和调试配置的运行路径搜索路径添加到您的构建目标(构建设置 -> 链接 -> 运行路径搜索路径):

$(PYLON_LIBRARY_DIR)/Frameworks

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM