Utkarsh Sinha
Utkarsh Sinha

Reputation: 3305

Linking to static libraries in Visual Studio 2010

Things to know:

I've read that I need to use the new UI (Common properties > Add New Reference thingy). But for this to work, I need to add the entire project to my solution. Is there a way to just link my project to the static library (without adding its source code).

Upvotes: 4

Views: 14347

Answers (1)

Hans Passant
Hans Passant

Reputation: 941218

The 'Add New Reference' thingy is a .NET option, used to add an assembly reference. You can't create static link libraries in .NET, assemblies are always dynamically loaded. Suspending disbelief and actually answering the question: you use the Browse tab in the dialog to avoid having to add the project to the solution.

Native projects that use a static link library must use the Linker, Input, Additional Dependencies setting instead. No need to add the project that generated the .lib either. If you don't specify the full path of the .lib then you can use Linker, General, Additional Linker Directories to tell the linker where to look for the .lib

Upvotes: 7

Related Questions