• <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 逛奔的蝸牛 閱讀(1276) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Qt
            亚洲国产日韩欧美综合久久| 精品国产99久久久久久麻豆 | 久久99久久无码毛片一区二区| 无码人妻久久一区二区三区免费丨| 久久人人爽人人精品视频| 无码人妻少妇久久中文字幕 | 国产69精品久久久久久人妻精品| 怡红院日本一道日本久久| 久久99国产精品二区不卡| 久久超乳爆乳中文字幕| 91精品国产91久久综合| 一本色道久久88加勒比—综合| 国产99久久久国产精品~~牛 | 久久成人国产精品二三区| 香蕉久久夜色精品国产小说| 99久久综合国产精品二区| 国产农村妇女毛片精品久久| 狠狠色丁香久久婷婷综合图片| 色综合久久久久无码专区| 四虎国产精品免费久久久| 久久亚洲国产精品五月天婷| 国产毛片欧美毛片久久久| 色综合久久天天综合| 日本WV一本一道久久香蕉| 欧美va久久久噜噜噜久久| 国内精品久久久久久久久电影网| 中文字幕亚洲综合久久菠萝蜜| 99久久免费国产精品热| 久久久久亚洲av成人无码电影| 亚洲国产精品18久久久久久| 伊人久久免费视频| 一本久久a久久精品亚洲| 91精品国产91久久久久久蜜臀| 久久久久久久波多野结衣高潮| 久久久综合九色合综国产| 一本色道久久综合狠狠躁| 久久久久亚洲爆乳少妇无| 久久午夜电影网| 久久综合综合久久综合| 久久精品免费全国观看国产| 91久久九九无码成人网站|