views:

37

answers:

2

Hi, I created a static library, I have the .lib and headers. My friend try to use this library, but when he include this headers, his compiler didn't find the dependencies(other libs and header).

Is it possible to create a static library in Visual Studio 2008, which don't need any other dependencies, just the compiler add the required dependencies in this signle lib?

It could be good if he doesn't have to install winddk, wdk, etc...

A: 

I think you want to include the runtime libraries inside your .lib file.

  1. Right click on your project
  2. Go to configuration Properties -> C/C++ -> Code Generation pane
  3. For Runtime Library select Multi-Threaded Debug (/MTd)

Repeat stpes 1-3 for the Release configuration as well.

The user of your .lib file will need to do the same in their .exes. You will still need to distribute the .lib file and the .h files.

Brian R. Bondy
A: 

Is it possible to create a static library in Visual Studio 2008, which don't need any other dependencies, just the compiler add the required dependencies in this signle lib?

yes .. microsoft visual c compiler doesn't support building exe/lib with zero dependency
Zero Dependency = only needs system lib and msvcrt.dll

Mingw does support that using -static in the linker options
will generate a dependncy free build needs msvcrt.dll runtime which can be found on any system ..
as for microsoft's visual c compiler it will require the same version of the c runtime for example msvcrt9p.dll ,...
that forces anyone who wants to run the application to download the same version .Net Runtime used in development

VirusEcks