<legend id='iXNry'><style id='iXNry'><dir id='iXNry'><q id='iXNry'></q></dir></style></legend>

        <bdo id='iXNry'></bdo><ul id='iXNry'></ul>
    1. <small id='iXNry'></small><noframes id='iXNry'>

    2. <i id='iXNry'><tr id='iXNry'><dt id='iXNry'><q id='iXNry'><span id='iXNry'><b id='iXNry'><form id='iXNry'><ins id='iXNry'></ins><ul id='iXNry'></ul><sub id='iXNry'></sub></form><legend id='iXNry'></legend><bdo id='iXNry'><pre id='iXNry'><center id='iXNry'></center></pre></bdo></b><th id='iXNry'></th></span></q></dt></tr></i><div id='iXNry'><tfoot id='iXNry'></tfoot><dl id='iXNry'><fieldset id='iXNry'></fieldset></dl></div>
      <tfoot id='iXNry'></tfoot>

      Visual C++ 中的 DLL 引用

      时间:2023-10-06

            <tbody id='GCWRW'></tbody>
          <legend id='GCWRW'><style id='GCWRW'><dir id='GCWRW'><q id='GCWRW'></q></dir></style></legend>
              <bdo id='GCWRW'></bdo><ul id='GCWRW'></ul>

              • <i id='GCWRW'><tr id='GCWRW'><dt id='GCWRW'><q id='GCWRW'><span id='GCWRW'><b id='GCWRW'><form id='GCWRW'><ins id='GCWRW'></ins><ul id='GCWRW'></ul><sub id='GCWRW'></sub></form><legend id='GCWRW'></legend><bdo id='GCWRW'><pre id='GCWRW'><center id='GCWRW'></center></pre></bdo></b><th id='GCWRW'></th></span></q></dt></tr></i><div id='GCWRW'><tfoot id='GCWRW'></tfoot><dl id='GCWRW'><fieldset id='GCWRW'></fieldset></dl></div>

              • <tfoot id='GCWRW'></tfoot>

                <small id='GCWRW'></small><noframes id='GCWRW'>

                本文介绍了Visual C++ 中的 DLL 引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我有 C++ 经验,但没有 MSVC.

                I have had C++ experience but not MSVC.

                我想做的是将开源项目中的 .dll 合并到我的项目中.代码可用,我已经构建了它.我有 .dll 和 .lib,据我所知,C++ 项目需要它.

                What I am trying to do is incorporate a .dll from an open source project into my project. The code is available and I have built it. I have the .dll as well as the .lib which as I understand it is required for C++ projects.

                不幸的是,现在没有简单的添加引用",将我的 .dll 放入包含目录并将其添加到我的解决方案中.我编辑了项目属性页、C/C++ 附加包含目录选项以及添加 .lib 作为附加链接器依赖项.我在我的解决方案树中为 dll 和 lib 创建了一个包含目录.

                Now unfortunately there is no simple "Add Reference", drop my .dll into an include directory and add that to my solution. I have edited the project property pages, the C/C++ Additional Include Directories option as well as adding the .lib as an additional linker dependency. I have created an include directory for the dll and lib inside my solution tree.

                我的问题是当我尝试包含文档中的头文件时,VS 输出会吐出错误消息.现在我意识到我正在使用 dll/lib 组合并且 .h 文件不存在于我的解决方案中,那么我如何添加正确的包含?我也在使用 QT 工具包,它也可以工作,但是我如何从开源库中添加其他头文件/dll 不知道.

                My problem is when I try to include the header files from the documentation, VS output spits out error messages. Now I realize that I am using the dll/lib combo and that the .h files are not present in my solution so how do I add the proper includes? I am using QT toolkit also which is working but how I add the other header / dll from the open source library eludes me.

                有人能指出我正确的方向吗.

                Can someone please point me in the right direction.

                推荐答案

                你需要做一些事情来使用这个库:

                You need to do a couple of things to use the library:

                1. 确保您拥有要使用的库中的 *​​.lib 和 *.dll.如果您没有 *.lib,请跳过 #2

                1. Make sure that you have both the *.lib and the *.dll from the library you want to use. If you don't have the *.lib, skip #2

                在项目中添加对 *.lib 的引用.在解决方案资源管理器中右键单击项目名称,然后选择配置属性->链接器->输入并将库的名称放在附加依赖项属性中.

                Put a reference to the *.lib in the project. Right click the project name in the Solution Explorer and then select Configuration Properties->Linker->Input and put the name of the lib in the Additional Dependencies property.

                您必须确保 VS 可以找到您刚刚添加的库,因此您必须转到工具"菜单并选择选项...",然后在项目和解决方案"下选择VC++ 目录",编辑库目录"选项.从这里,您可以通过在显示目录:"下拉框中选择库文件"来设置包含新库的目录.只需在目录列表中添加 lib 文件的路径即可.如果您没有库,您可以省略它,但是当您在这里时,您还需要在包含文件"下设置包含头文件的目录.以与添加 lib 相同的方式进行操作.

                You have to make sure that VS can find the lib you just added so you have to go to the Tools menu and select Options... Then under Projects and Solutions select VC++ Directories,edit Library Directory option. From within here you can set the directory that contains your new lib by selecting the 'Library Files' in the 'Show Directories For:' drop down box. Just add the path to your lib file in the list of directories. If you dont have a lib you can omit this, but while your here you will also need to set the directory which contains your header files as well under the 'Include Files'. Do it the same way you added the lib.

                完成此操作后,您应该可以开始使用您的图书馆了.如果您没有 lib 文件,您仍然可以通过自己导入来使用 dll.在应用程序启动期间,您可以通过调用 LoadLibrary 显式加载 dll(请参阅:http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx 了解更多信息)

                After doing this you should be good to go and can use your library. If you dont have a lib file you can still use the dll by importing it yourself. During your applications startup you can explicitly load the dll by calling LoadLibrary (see: http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx for more info)

                干杯!

                编辑

                记得使用#include <Foo.h > 而不是 #include "foo.h".前者搜索包含路径.后者使用本地项目文件.

                Remember to use #include < Foo.h > as opposed to #include "foo.h". The former searches the include path. The latter uses the local project files.

                这篇关于Visual C++ 中的 DLL 引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:错误 LNK2005: xxx 已在 MSVCRT.lib(MSVCR100.dll) C:somethi 下一篇:是 !!在 C++ 中转换为 bool 的安全方法?

                相关文章

                最新文章

                  1. <tfoot id='hYvvb'></tfoot>

                    <small id='hYvvb'></small><noframes id='hYvvb'>

                    <i id='hYvvb'><tr id='hYvvb'><dt id='hYvvb'><q id='hYvvb'><span id='hYvvb'><b id='hYvvb'><form id='hYvvb'><ins id='hYvvb'></ins><ul id='hYvvb'></ul><sub id='hYvvb'></sub></form><legend id='hYvvb'></legend><bdo id='hYvvb'><pre id='hYvvb'><center id='hYvvb'></center></pre></bdo></b><th id='hYvvb'></th></span></q></dt></tr></i><div id='hYvvb'><tfoot id='hYvvb'></tfoot><dl id='hYvvb'><fieldset id='hYvvb'></fieldset></dl></div>

                      <bdo id='hYvvb'></bdo><ul id='hYvvb'></ul>
                  2. <legend id='hYvvb'><style id='hYvvb'><dir id='hYvvb'><q id='hYvvb'></q></dir></style></legend>