• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            逛奔的蝸牛

            我不聰明,但我會(huì)很努力

               ::  :: 新隨筆 ::  ::  :: 管理 ::

            Using a third-party library with Qt is a simple process. Suppose you know of a cross-platform library that accepts audio samples of a cat's meows and translates them into English words. This library is named CatWhisperer, and has several files that it provides as part of its library. Your project, MyQtApp, stores these files in a folder named 3rdparty:

            • MyQtApp/
              • MyQtApp.pro
              • src/
                • main.cpp
              • 3rdparty/
                • CatWhisperer
                  • include/
                    • CatWhisperer.h
                  • lib/
                    • libCatWhisperer.so
                    • CatWhisperer.lib
                  • bin/
                    • CatWhisperer.dll

            To use the CatWhisperer library in MyQtAppqmake requires the location and names of the CatWhisperer libraries. Optionally, you can also:

            • Provide the location of the CatWhisperer source code so that you don't have to type out the full path to each file when you include them in your own code.
            • Choose the destination in which the MyQtApp executable will be created.

            The information above is provided in the .pro file, so that qmake can parse it and produce makefiles. Makefiles contain all the information needed by your compiler and linker to produce output, whether it is an executable, another library file, etc. The next sections explain the syntax with which qmakeexpects you to provide this information.

            Source code

            To be able to write

            #include <CatWhisperer.h>

            instead of

            #include <3rdparty/CatWhisperer/include/CatWhisperer.h>

            you can provide the path to the CatWhisperer include directory, using the INCLUDEPATH variable:

            INCLUDEPATH += 3rdparty/CatWhisperer/include

            Library files

            To let qmake know where to find the CatWhisperer library files, use the LIBS variable:

            LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer

            The first part of the expression lets the linker know in which directory it should look for the library files. The double quotes are only necessary when the path contains spaces, so we could have omitted them in this example.

            The second part tells the linker which libraries to link against. We have two different library files for UNIX platforms and Windows, respectively:libCatWhisperer.so and CatWhisperer.lib. It is not necessary to specify the .lib extension, nor the lib prefix (on UNIX platforms).

            Destination directory

            By default, qmake creates the executable in the same directory as the .pro file. We can choose our own directory using the DESTDIR variable:

            DESTDIR = bin

            That's it! You can now use the CatWhisperer library in your project. The final .pro file looks like this:

            TARGET = MyQtApp
            TEMPLATE = app
            INCLUDEPATH += 3rdparty/CatWhisperer/include
            SOURCES += src/main.cpp
            LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer

            See also qmake Manual and Adding Libraries to Projects.

            @import url(http://m.shnenglu.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
            posted on 2013-06-28 07:31 逛奔的蝸牛 閱讀(1269) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): Qt
            亚洲精品无码久久久久去q| 久久国产成人精品国产成人亚洲| 精品久久久久久久中文字幕| 93精91精品国产综合久久香蕉| 国产国产成人久久精品| 欧美激情一区二区久久久| 久久久久高潮毛片免费全部播放| 久久精品国产99国产电影网 | 欧美喷潮久久久XXXXx| 国产精品一久久香蕉产线看| 九九久久精品国产| 人妻精品久久无码区| 色99久久久久高潮综合影院| 久久精品国产99久久无毒不卡| 久久久久久国产精品无码下载| 亚洲精品午夜国产VA久久成人| 99久久国产亚洲高清观看2024| 亚洲午夜久久久影院伊人| AA级片免费看视频久久| 久久国产精品成人片免费| 精品久久久久久无码不卡| 草草久久久无码国产专区| 国产91色综合久久免费分享| 日本五月天婷久久网站| 人妻丰满?V无码久久不卡| 国产AⅤ精品一区二区三区久久| av无码久久久久不卡免费网站| 亚洲综合日韩久久成人AV| 国内精品伊人久久久影院| 亚洲精品无码久久久久AV麻豆| 久久99精品久久久久久秒播| 久久亚洲国产精品一区二区| 久久国产精品一国产精品金尊| 久久精品aⅴ无码中文字字幕不卡| 久久中文字幕精品| 久久毛片一区二区| 久久人人爽人人爽人人片AV麻烦| 日本加勒比久久精品| 久久天天躁狠狠躁夜夜不卡| 久久综合偷偷噜噜噜色| 久久久久久精品免费免费自慰|