简体   繁体   English

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

[英]Using .dll in Visual Studio 2010 C++

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. 我将.DLL和.LIB文件放在与项目相同的目录中,转到属性 - >公共属性 - >框架和参考 - >添加新参考。 But the list comes up empty. 但名单上空了。

Is there something else I should be doing? 还有什么我应该做的吗?

C++ is not C#. C ++不是C#。 You don't include .dlls in C++ applications by adding "references". 通过添加“引用”,您不会在C ++应用程序中包含.dll。 Unless it's C++/CLI, but that's not C++. 除非它是C ++ / CLI,但那不是C ++。

In C++, you would go, in the project configuration, to Linker->Input->Additional Dependencies. 在C ++中,您可以在项目配置中使用Linker-> Input-> Additional Dependencies。 There, you would list the library name plus path to the .lib in question. 在那里,您将列出库名称以及相关.lib的路径。

Normally, when you build a Windows C/C++ DLL, you also get a .lib. 通常,在构建Windows C / C ++ DLL时,您还会获得.lib。 This is an import library; 这是一个导入库; users of the library include (as stated above) that .lib in order to access the DLL. 该库的用户包括(如上所述).lib以便访问DLL。 They generally do not load the .dll directly (though there are ways to do that). 它们通常不直接加载.dll(虽然有办法做到这一点)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM