Search code examples
visual-studio-2010dlllinkerlinker-errorsworkspace

VS2010 linker error, looking for a .lib of a .dll file


I am building a Visual C++ 6.0 workspace in Visual Studio 2010, so that it'll update some dependencies

I have all the files and dll's it is looking for, it builds but then fails at linking with this error

1>LINK : fatal error LNK1181: cannot open input file '\Projects\exe\CRelease/api.lib'

I have api.dll which it needs to build, but I don't have a .lib file version of it. and even if I did (like if I somehow converted the .dll into a .lib), I wouldn't know where to place it in a directory structure

how do I "fix" this?

guidance appreciated, thank you


Solution

  • Normally api.dll would have an accompanying import library called api.lib which is what you need to link to. The import library is different to a statically-compiled version of api (which would also likely be called api.lib) - it's more like a list of available functions provided by the dll, and so will usually be much smaller than a corresponding static library.

    If you do find or get api.lib, it doesn't really matter where it lives, as long as it can be accessed by your linker.

    If you don't find the import library, you're looking at doing explicit run-time linking where api.dll is loaded and unloaded explicitly in your code, and api's exported functions are called through function pointers.