在 Visual Studio 2010 C++ 中使用 .dll

Using .dll in Visual Studio 2010 C++(在 Visual Studio 2010 C++ 中使用 .dll)

本文介绍了在 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