在 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).
相关文章