如何在Visual Studio C ++中使用第三方DLL文件? [英] How do I use a third-party DLL file in Visual Studio C++?

查看:184
本文介绍了如何在Visual Studio C ++中使用第三方DLL文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我明白我需要使用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 ++,这是我不唯一的部分get(作为Java程序员)。我只是想研究如何使用 Qt 库和tesseract-ocr,但该过程不会对我来说很难,而且很难google。

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中使用的类和函数原型。

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文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆