• <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>

            逛奔的蝸牛

            我不聰明,但我會很努力

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

            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 逛奔的蝸牛 閱讀(1264) 評論(0)  編輯 收藏 引用 所屬分類: Qt
            激情综合色综合久久综合| 久久无码AV中文出轨人妻| 999久久久免费精品国产| 久久99国产精品久久99| 久久九色综合九色99伊人| 久久免费视频1| 久久99国产精品二区不卡| 久久亚洲视频| WWW婷婷AV久久久影片| 久久久久久国产精品无码下载| 久久精品人人做人人爽97| 99久久精品国产一区二区三区| 久久综合九色综合欧美狠狠| 久久久久国产一级毛片高清板| 四虎久久影院| 久久久无码一区二区三区| 久久97久久97精品免视看秋霞| 一本色道久久HEZYO无码| 一本久久a久久精品综合夜夜 | 久久99国产综合精品女同| 久久精品国产亚洲欧美| 亚洲性久久久影院| 91精品国产综合久久香蕉| 伊人久久大香线焦AV综合影院 | 亚洲成色WWW久久网站| 久久久99精品成人片中文字幕 | 久久久这里有精品中文字幕| 久久久久高潮综合影院| 久久午夜福利电影| 久久91综合国产91久久精品| 日本欧美久久久久免费播放网 | 无码日韩人妻精品久久蜜桃| 久久久久亚洲AV成人网人人软件| 国内精品久久久久久久97牛牛| 久久久WWW免费人成精品| 国产精品久久自在自线观看| 久久水蜜桃亚洲av无码精品麻豆| 思思久久99热只有频精品66| 欧美日韩成人精品久久久免费看| 人妻丰满?V无码久久不卡| 久久综合综合久久狠狠狠97色88|