Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lib.exe, Visual Studio, generating .lib files from dll's and def files

I am new to windows and visual studio. I have to compile a code written in c++. It uses different libraries. I found the dll files for those libraries. I can compile the source without any problem but there are link problems. I do not know how to link dll files. I understood that I need .lib files for that. But some of the libraries required do not have any lib files provided. There are only dll files and dif files. How can I generate the required lib files by using Visual studio 2010 ultimate? I cannot find a program called lib.exe. Thank You.

like image 845
delete_this_account Avatar asked Mar 17 '11 19:03

delete_this_account


People also ask

How do I create a .LIB file in Visual Studio?

To create a static library project in Visual StudioOn the menu bar, choose File > New > Project to open the Create a New Project dialog. At the top of the dialog, set Language to C++, set Platform to Windows, and set Project type to Library.

What is Lib EXE?

The Microsoft Library Manager (LIB.exe) creates and manages a library of Common Object File Format (COFF) object files. LIB can also be used to create export files and import libraries to reference exported definitions. Note. You can start this tool only from the Visual Studio command prompt.

What is the difference between LIB and DLL?

LIB vs DLLLIB is a static library where functions and procedures can be placed and called as the application is being compiled. A DLL or Dynamic Link Library does the same function but is dynamic in a sense that the application can call these libraries during run-time and not during the compilation.

How do I run a .LIB EXE file?

LIB Command Line To run LIB, type the command lib , followed by the options and file names for the task you're using LIB for.


1 Answers

You are indeed going to need lib.exe to turn the .def file into a .lib file that the linker needs. It is stored in the vc\bin directory of the visual studio directory, C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\lib.exe by default. The easiest way is to use the "Visual Studio Command Prompt", you'll find it in the Start menu, Microsoft Visual Studio 2010, Visual Studio Tools.

Next, run lib.exe with the /def:foo.def option to generate the .lib. Follow the vendor's instructions, if provided. And don't hesitate to contact them for support.

like image 130
Hans Passant Avatar answered Sep 19 '22 16:09

Hans Passant