0

I am trying to use MathGL in my project. When i go through the package contents i can only find .a static library files, how can i use those to include that library in my Visual Studio project?

I have tried to include all the .a files by going to Project Properties->Configuration Properties->Linker->Input

and link all the .a files using "additional dependencies". But then i still get a ton of errors when i include the mgl.h file.

I guess my question is: is the way to use a library in your program is to include the needed .a files? and if yes, what is the correct way to do it?

  • 1
    Have you seen this link: http://mathgl.sourceforge.net/doc_en/Download.html#Download ? Here you can download the MataGL library for Linux or Windows – Jorge Omar Medra Jul 05 '17 at 05:29
  • Possible duplicate of [What is a file with extension .a?](https://stackoverflow.com/questions/5965171/what-is-a-file-with-extension-a) – Lanting Jul 05 '17 at 05:59
  • 1
    In a Windows application you cannot. – Jesper Juhl Jul 05 '17 at 05:59
  • @JorgeOmarMedra Yes, i downloaded that, but there aren't any .lib files in the package, just .a files. –  Jul 06 '17 at 21:32
  • @Lanting I did checkout the link, but it didn't help me with figuring out how to link the library in visual studio. –  Jul 06 '17 at 21:34
  • Are you saying that there is no way to use .a libraries in Visual Studio? @JesperJuhl –  Jul 06 '17 at 21:35

1 Answers1

1

According with the documentation of MathGL, the libraries are into the directory mathgl/lib, and they are dinamic link libraries(dlls):

enter image description here

The same documentation says:

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).

So, you need to link the Dll instead of a static library, check this asnwer to see how to link a dll: Linking dll in Visual Studio

Jorge Omar Medra
  • 978
  • 1
  • 9
  • 19