How to link .a files in Visual Studio 2012?

I have some static libraries in the form of .a files and related header files (.h). How do I tell the linker of these files to the Visual Studio 2012 Windows Desktop Express linker so that I don't get "unresolved external characters" errors when I try to build?

0
source share
2 answers
  • Include the .h header files and make sure they are present in your project.
  • Go to "Project Properties"> "Configuration Properties"> "C / C ++"> "General"> "Additional Include Directories" and add the path to the include directory in which your header files can be found
  • Go to "Project Properties"> "Configuration Properties"> "Connector"> "General"> "Additional Libraries" and add the path to the lib directory where you can find your .a files.
  • Go to "Project Properties"> "Configuration Properties"> "Connector"> "Enter"> "Additional Dependencies" and specify the .a file exactly

Also, make sure that you are on the correct configuration platform when building (x86 vs x64), and it is similar to the one your library uses.

+2
source

As far as I know, you cannot. Usually they use a different internal binary format that the linker cannot understand. Similarly, MinGW will not be able to use Visual Studio library files (unless you use an additional tool to convert them).

You will have to recompile the library from the source or obtain library files compatible with Visual Studio.

+1
source

Source: https://habr.com/ru/post/1275806/


All Articles