• <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 逛奔的蝸牛 閱讀(1268) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): Qt
            国产成人久久AV免费| 久久青青草原精品国产不卡| 久久久久国产一区二区三区| 亚洲欧美精品一区久久中文字幕| 国产精品美女久久福利网站| 久久99国产综合精品免费| 一级做a爱片久久毛片| 久久人做人爽一区二区三区 | 国产精品久久久99| 久久99精品久久久久久久不卡| 婷婷综合久久中文字幕| 久久久久亚洲av成人网人人软件| A狠狠久久蜜臀婷色中文网| 久久久久久青草大香综合精品| 久久久久久久人妻无码中文字幕爆| 婷婷久久综合| 久久久久国色AV免费看图片| 精品一区二区久久| 久久A级毛片免费观看| 久久综合久久综合亚洲| 久久久久国产精品麻豆AR影院| 国产成人久久精品激情| 久久精品国产AV一区二区三区| 久久毛片免费看一区二区三区| 国产成人精品白浆久久69| 久久久亚洲欧洲日产国码aⅴ| 久久中文精品无码中文字幕| 国产一区二区精品久久凹凸| 久久久久亚洲AV成人网人人网站| 久久精品国内一区二区三区| 嫩草伊人久久精品少妇AV| 久久精品国产网红主播| 99久久99久久精品国产片果冻 | 欧美综合天天夜夜久久| 97精品伊人久久久大香线蕉 | 伊人久久大香线蕉成人| 国产精品久久久久久久久软件| 久久久久综合国产欧美一区二区| 久久精品成人免费国产片小草| 久久久久综合国产欧美一区二区| 欧美精品丝袜久久久中文字幕 |