• <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://www.shnenglu.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
            posted on 2013-06-28 07:31 逛奔的蝸牛 閱讀(1268) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): Qt
            久久99精品国产99久久| 日韩中文久久| 久久ZYZ资源站无码中文动漫| 狼狼综合久久久久综合网| 性做久久久久久久| 久久综合综合久久狠狠狠97色88 | 亚洲伊人久久成综合人影院| 欧美色综合久久久久久| 亚洲狠狠婷婷综合久久久久| 日本福利片国产午夜久久| 久久国产成人| 精品乱码久久久久久久| 无码8090精品久久一区| 精品综合久久久久久97超人| 亚洲七七久久精品中文国产| 99久久精品费精品国产一区二区 | 久久精品成人欧美大片| 天天综合久久久网| 精品久久8x国产免费观看| 久久综合给合久久狠狠狠97色69 | 久久久久亚洲AV成人网| 亚洲AV乱码久久精品蜜桃| 久久无码精品一区二区三区| 精品国产福利久久久| 亚洲精品乱码久久久久久| 久久久久国产一区二区三区| 国产精品国色综合久久| 久久精品国产色蜜蜜麻豆| 一本色道久久88综合日韩精品 | 香蕉久久夜色精品升级完成| 香蕉99久久国产综合精品宅男自 | 综合久久国产九一剧情麻豆| 久久精品亚洲福利| 国内精品伊人久久久久影院对白| 欧美精品丝袜久久久中文字幕| 久久久久国产一级毛片高清版| 久久精品中文字幕第23页| 69久久精品无码一区二区| 久久99精品国产自在现线小黄鸭 | 国产成年无码久久久免费| 久久影院亚洲一区|