問題描述
我知道我需要使用 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 文件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!