• <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 逛奔的蝸牛 閱讀(1269) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): Qt
            久久久久亚洲av综合波多野结衣| 久久天天婷婷五月俺也去| 999久久久无码国产精品| 久久精品99久久香蕉国产色戒| 久久久久人妻精品一区二区三区| 国内精品久久久久久久涩爱| 久久人妻少妇嫩草AV蜜桃| 久久99毛片免费观看不卡 | 久久午夜羞羞影院免费观看| 国产A级毛片久久久精品毛片| 精产国品久久一二三产区区别| 精品国产乱码久久久久久1区2区| 香港aa三级久久三级老师2021国产三级精品三级在| 一级做a爰片久久毛片免费陪| 热re99久久精品国产99热| 久久夜色精品国产噜噜噜亚洲AV | 亚洲国产成人精品无码久久久久久综合 | 成人亚洲欧美久久久久| 久久综合给合久久狠狠狠97色 | 久久国产精品99精品国产| yy6080久久| 色狠狠久久综合网| 女同久久| 免费精品国产日韩热久久| 久久婷婷五月综合97色直播| 高清免费久久午夜精品| 国产成人无码久久久精品一| 色妞色综合久久夜夜| 亚洲精品乱码久久久久久中文字幕 | 国产成人久久精品二区三区| 国产一区二区三区久久精品| 久久国产精品99国产精| 97久久香蕉国产线看观看| 99久久99久久| 99久久99久久精品国产片果冻| 久久国产一区二区| 99久久国产亚洲高清观看2024| 亚洲国产精品久久久久| 精品国产热久久久福利| 久久久久99这里有精品10| 久久久久久精品免费看SSS|