How to statically link a dll/lib?

Started by
0 comments, last by Krohm 12 years, 3 months ago
Simple questions is how do i statically link a .lib file or .dll to my program in VS2010? im wanting to avoid having to haul the dll around! thanks
Advertisement
.lib files are supposed to be linked by the compiler. They don't need to ship. VS2010 has a few ways to do that, in project's context menu there's project dependancies (link to .lib created by other projects in the same solution); in project's Property pages->Common Properties there are references. Again, I mostly use this to link to other projects in the same solutions.

To link generic .libs there is Property pages->Linker->Additional dependancies.
I am slightly inclined to an old method: #pragma comment(lib, yourLibFile) in the code. I like the advantage of noting dependancies in source, rather than in project settings.

As for dlls, it is required to rebuild them as .lib. They need to be shipped with the executable, no way around it.

Previously "Krohm"

This topic is closed to new replies.

Advertisement