我知道我需要使用 LoadLibrary().但是我还需要采取哪些其他步骤才能使用第三方 DLL 文件?
I understand that I need to use LoadLibrary(). But what other steps do I need to take in order to use a third-party DLL file?
我只是跳入了 C++,这是我唯一没有得到的部分(作为 Java 程序员).我只是在研究如何使用 Qt 库和 tesseract-ocr,然而这个过程对我来说毫无意义,而且很难用谷歌搜索.
I simply jumped into C++ and this is the only part that I do not get (as a Java programmer). I am just looking into how I can use a Qt Library and tesseract-ocr, yet the process makes no sense to me and is so difficult to google.
我如何告诉编译器我正在使用的函数?是否应该有来自第三方供应商的包含文件?
How do I tell the compiler of the functions that I am using? Should there be an include file from the third-party vendor?
正如其他人所说,LoadLibrary 很难做到,而且几乎没有必要.
As everyone else says, LoadLibrary is the hard way to do it, and is hardly ever necessary.
DLL 应该带有一个用于链接的 .lib 文件,以及一个或多个头文件以 #include 到您的源代码中.头文件将定义您可以从 DLL 中使用的类和函数原型.即使您使用 LoadLibrary,您也将需要它.
The DLL should have come with a .lib file for linking, and one or more header files to #include into your sources. The header files will define the classes and function prototypes that you can use from the DLL. You will need this even if you use LoadLibrary.
要与库链接,您可能需要将 .lib 文件添加到链接器/输入/附加依赖项下的项目配置中.
To link with the library, you might have to add the .lib file to the project configuration under Linker/Input/Additional Dependencies.
这篇关于如何在 Visual Studio C++ 中使用第三方 DLL 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!