Re: Static library problem
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Wed, 23 Nov 2005 19:21:06 -0500
Rasmus Oudal Edberg <rasmus@xxxxxxxxxxxxxxxxx> wrote:
> I have project 'BaseFramework' which is a static library(.lib)
> project, this project uses some C functions from a vendor.
>
> I also have a project B which is an application(.exe) project,
> this project includes the a.lib file.
>
> The 'BaseFramework' project builds just fine, but my problem is that
> when I try to build project B I get a lot LNK2019 errors saing that
> the linker cannot resolve the C functions that the 'BaseFramework'
> project is using, like this:
When you build a static library, it does _not_ incorporate its
dependencies - it just refers to them. In other words, the static
library is not processed by the linker.
When you then build the final module (an EXE or a DLL) you have to
explicitly link against your static library and all its dependencies.
One way to do this is to put the following line in some header file that
every user of your static library must include:
#pragma comment( lib, "theother.lib" )
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- References:
- Static library problem
- From: Rasmus Oudal Edberg
- Static library problem
- Prev by Date: Static library problem
- Next by Date: Re: using PRINTDLGEX API call to select a printer
- Previous by thread: Static library problem
- Index(es):