Using .dll in Visual Studio 2010 C++(在 Visual Studio 2010 C++ 中使用 .dll)
问题描述
我有问题.我将我的 .DLL 和 .LIB 文件放在与我的项目相同的目录中,转到 Properties -> Common Properties -> Framework and References -> Add New Reference.但是列表显示为空.
I have a problem. I place my .DLL and .LIB file in the same directory as my project, go to Properties -> Common Properties -> Framework and References -> Add New Reference. But the list comes up empty.
还有什么我应该做的吗?
Is there something else I should be doing?
推荐答案
C++ 不是 C#.您不会通过添加引用"在 C++ 应用程序中包含 .dll.除非是 C++/CLI,但那不是 C++.
C++ is not C#. You don't include .dlls in C++ applications by adding "references". Unless it's C++/CLI, but that's not C++.
在 C++ 中,您将在项目配置中转到 Linker->Input->Additional Dependencies.在那里,您将列出库名称以及相关 .lib 的路径.
In C++, you would go, in the project configuration, to Linker->Input->Additional Dependencies. There, you would list the library name plus path to the .lib in question.
通常,当您构建 Windows C/C++ DLL 时,您还会获得一个 .lib.这是一个导入库;库的用户包括(如上所述)该 .lib 以便访问 DLL.他们通常不直接加载 .dll(尽管有办法做到这一点).
Normally, when you build a Windows C/C++ DLL, you also get a .lib. This is an import library; users of the library include (as stated above) that .lib in order to access the DLL. They generally do not load the .dll directly (though there are ways to do that).
这篇关于在 Visual Studio 2010 C++ 中使用 .dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Visual Studio 2010 C++ 中使用 .dll
- C++ 协变模板 2021-01-01
- 近似搜索的工作原理 2021-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 从python回调到c++的选项 2022-11-16
- 静态初始化顺序失败 2022-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- STL 中有 dereference_iterator 吗? 2022-01-01