gpt4 book ai didi

c++ - 如何将 .a 类型的静态库添加到 Visual Studio 项目中?

转载 作者:行者123 更新时间:2023-11-28 05:05:31 25 4
gpt4 key购买 nike

我正在尝试使用 MathGL在我的项目中。当我浏览包内容时,我只能找到 .a 静态库文件,我如何使用这些文件将该库包含在我的 Visual Studio 项目中?

我试图通过转到项目属性->配置属性->链接器->输入来包含所有 .a 文件

并使用“附加依赖项”链接所有 .a 文件。但是当我包含 mgl.h 文件时,我仍然会遇到很多错误。

我想我的问题是:在程序中使用库的方法是包含所需的 .a 文件吗?如果是,正确的方法是什么?

最佳答案

根据MathGL的文档,库在ma​​thgl/lib目录下,它们是动态链接库(dlls):

enter image description here

同样的文档说:

Use a precompiled binary. There are binaries for MinGW (platform Win32). For a precompiled variant one needs only to unpack the archive to the location of the Chapter 1: Overview 3 compiler (i.e. mathgl/lib in mingw/lib, mathgl/include in mingw/include and so on) or in arbitrary other folder and setup paths in compiler. By default, precompiled versions include the support of GSL (www.gsl.org) and PNG. So, one needs to have these libraries installed on system (it can be found, for example, at http://gnuwin32. sourceforge.net/packages.html).

因此,您需要链接 Dll 而不是静态库,检查这个 asnwer 以了解如何链接 dll:Linking dll in Visual Studio

关于c++ - 如何将 .a 类型的静态库添加到 Visual Studio 项目中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44917587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com