• <bdo id='wbfcx'></bdo><ul id='wbfcx'></ul>
  1. <tfoot id='wbfcx'></tfoot>

      <i id='wbfcx'><tr id='wbfcx'><dt id='wbfcx'><q id='wbfcx'><span id='wbfcx'><b id='wbfcx'><form id='wbfcx'><ins id='wbfcx'></ins><ul id='wbfcx'></ul><sub id='wbfcx'></sub></form><legend id='wbfcx'></legend><bdo id='wbfcx'><pre id='wbfcx'><center id='wbfcx'></center></pre></bdo></b><th id='wbfcx'></th></span></q></dt></tr></i><div id='wbfcx'><tfoot id='wbfcx'></tfoot><dl id='wbfcx'><fieldset id='wbfcx'></fieldset></dl></div>

    1. <small id='wbfcx'></small><noframes id='wbfcx'>

      <legend id='wbfcx'><style id='wbfcx'><dir id='wbfcx'><q id='wbfcx'></q></dir></style></legend>
    2. 我如何通过终端命令在 mac 上编译它

      How do I compile this on mac by terminal command(我如何通过终端命令在 mac 上编译它)

          <legend id='G1HOQ'><style id='G1HOQ'><dir id='G1HOQ'><q id='G1HOQ'></q></dir></style></legend>
          • <bdo id='G1HOQ'></bdo><ul id='G1HOQ'></ul>
            <i id='G1HOQ'><tr id='G1HOQ'><dt id='G1HOQ'><q id='G1HOQ'><span id='G1HOQ'><b id='G1HOQ'><form id='G1HOQ'><ins id='G1HOQ'></ins><ul id='G1HOQ'></ul><sub id='G1HOQ'></sub></form><legend id='G1HOQ'></legend><bdo id='G1HOQ'><pre id='G1HOQ'><center id='G1HOQ'></center></pre></bdo></b><th id='G1HOQ'></th></span></q></dt></tr></i><div id='G1HOQ'><tfoot id='G1HOQ'></tfoot><dl id='G1HOQ'><fieldset id='G1HOQ'></fieldset></dl></div>

            <small id='G1HOQ'></small><noframes id='G1HOQ'>

                  <tbody id='G1HOQ'></tbody>
                <tfoot id='G1HOQ'></tfoot>
              • 本文介绍了我如何通过终端命令在 mac 上编译它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 xcode 编译我的 opencv 项目,我有一些设置如下:

                I am using xcode to compile my opencv project, and I have some settings as below:

                    HEADER_SEARCH_PATHS = /usr/local/include
                
                    LIBRARY_SEARCH_PATHS = /usr/local/lib
                
                    OTHER_LDFLAGS = -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videoio -lopencv_videostab
                

                我想知道我应该通过终端命令而不是xcode的设置来写什么.

                I want to know what shall I write by terminal command rather than setting of xcode.

                推荐答案

                如果你用 homebrew 安装了 OpenCV 并且你也安装了 pkgconfig使用 homebrew 打包,该包可以告诉您自己需要的设置 - 比您猜测的要准确得多.

                If you installed OpenCV with homebrew and you also installed the pkgconfig package with homebrew, the package can tell you the settings you need itself - far more accurately than you can guess them.

                最简单的方法是让 pkgconfig 列出它知道的所有包:

                The easy way is to ask pkgconfig to list all the packages it knows about:

                pkg-config --list-all | grep -i opencv
                
                opencv                 OpenCV - Open Source Computer Vision Library
                

                所以,现在你知道包名很简单opencv,你可以像这样找到你需要的标志:

                So, now you know the package name is plain and simple opencv, and you can find the flags you need like this:

                pkg-config --cflags --libs opencv
                -I/usr/local/Cellar/opencv/2.4.12_2/include/opencv 
                -I/usr/local/Cellar/opencv/2.4.12_2/include 
                -L/usr/local/Cellar/opencv/2.4.12_2/lib 
                -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab
                

                这意味着您的编译和链接变得简单:

                Which means your compilation and linking becomes simply:

                g++ $(pkg-config --cflags --libs opencv) program.cpp -o program
                

                如果您在 Makefile 中执行此操作,则需要将 $ 符号加倍.

                If you do that in a Makefile, you will need to double up the $ signs.

                如果您的系统安装得不是很好,您可能需要自己找到pkgconfig 文件.所以你会这样做:

                If your system is not so well installed, you may need to find the pkgconfig file yourself. So you would do:

                find /usr/local -name "opencv*pc"
                /usr/local/Cellar/opencv/2.4.12_2/lib/pkgconfig/opencv.pc
                

                然后您可以像这样访问该文件:

                Then you can access that file specifically like this:

                pkg-config --cflags --libs /usr/local/Cellar/opencv/2.4.12_2/lib/pkgconfig/opencv.pc
                

                这篇关于我如何通过终端命令在 mac 上编译它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Is Type(::x); valid?(是类型(::x);有效的?)
                Difference between an inline function and static inline function(内联函数和静态内联函数的区别)
                Compilation fails randomly: quot;cannot open program databasequot;(编译随机失败:“无法打开程序数据库)
                Too many initializers error for a simple array in bcc32(bcc32 中的简单数组的初始值设定项过多错误)
                No Member named stoi in namespace std(命名空间 std 中没有名为 stoi 的成员)
                Error using a constexpr as a template parameter within the same class(在同一个类中使用 constexpr 作为模板参数时出错)
                  <tbody id='b3Avd'></tbody>

                  <bdo id='b3Avd'></bdo><ul id='b3Avd'></ul>

                  <small id='b3Avd'></small><noframes id='b3Avd'>

                  • <i id='b3Avd'><tr id='b3Avd'><dt id='b3Avd'><q id='b3Avd'><span id='b3Avd'><b id='b3Avd'><form id='b3Avd'><ins id='b3Avd'></ins><ul id='b3Avd'></ul><sub id='b3Avd'></sub></form><legend id='b3Avd'></legend><bdo id='b3Avd'><pre id='b3Avd'><center id='b3Avd'></center></pre></bdo></b><th id='b3Avd'></th></span></q></dt></tr></i><div id='b3Avd'><tfoot id='b3Avd'></tfoot><dl id='b3Avd'><fieldset id='b3Avd'></fieldset></dl></div>

                        <legend id='b3Avd'><style id='b3Avd'><dir id='b3Avd'><q id='b3Avd'></q></dir></style></legend>

                        1. <tfoot id='b3Avd'></tfoot>