如何将 .a 类型的静态库添加到 visual studio 项目?
How can i add a static library of type .a to a visual studio project?
我正在尝试在我的项目中使用 MathGL。当我浏览包内容时,我只能找到 .a 静态库文件,我如何使用这些文件将该库包含在我的 Visual Studio 项目中?
我试图通过转到项目属性->配置属性->链接器->输入来包含所有 .a 文件
和 link 所有使用 "additional dependencies" 的 .a 文件。但是当我包含 mgl.h 文件时,我仍然会遇到很多错误。
我想我的问题是:在您的程序中使用库的方法是包含所需的 .a 文件吗?如果是,正确的方法是什么?
根据 MathGL 的文档,库位于目录 mathgl/lib 中,它们是动态的 link 库( dll):
同一文档说:
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).
所以,你需要 link Dll 而不是静态库,检查这个 asnwer 看看如何 link 一个 dll:Linking dll in Visual Studio
我正在尝试在我的项目中使用 MathGL。当我浏览包内容时,我只能找到 .a 静态库文件,我如何使用这些文件将该库包含在我的 Visual Studio 项目中?
我试图通过转到项目属性->配置属性->链接器->输入来包含所有 .a 文件
和 link 所有使用 "additional dependencies" 的 .a 文件。但是当我包含 mgl.h 文件时,我仍然会遇到很多错误。
我想我的问题是:在您的程序中使用库的方法是包含所需的 .a 文件吗?如果是,正确的方法是什么?
根据 MathGL 的文档,库位于目录 mathgl/lib 中,它们是动态的 link 库( dll):
同一文档说:
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).
所以,你需要 link Dll 而不是静态库,检查这个 asnwer 看看如何 link 一个 dll:Linking dll in Visual Studio