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

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

问题描述

我明白我需要使用LoadLibrary()。但是为了使用第三方DLL文件,还需要采取哪些其他步骤?



我只是跳入C ++,这是我不唯一的一部分get(作为Java程序员)。我只是研究如何使用 Qt 图书馆和tesseract-ocr,但是这个过程对我来说没有意义,而且很难google。



如何告诉编译器我正在使用的函数?应该有来自第三方供应商的包含文件?

解决方案

正如其他人所说,LoadLibrary是难以做到的它并不是必需的。



该DLL应该带有.lib文件进行链接,并且一个或多个头文件将#包含到您的源中。头文件将定义可以从DLL使用的类和函数原型。即使您使用LoadLibrary,也需要使用。



要链接到库,您可能需要将.lib文件添加到链接器/输入/附加项下的项目配置依赖关系。


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?

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?

解决方案

As everyone else says, LoadLibrary is the hard way to do it, and is hardly ever necessary.

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.

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天全站免登陆