开发者

Linking to static libraries in Visual Studio 2010

开发者 https://www.devze.com 2023-03-09 12:28 出处:网络
Things to know: I\'m quite sure that I\'m using the right static libraries (with dllexport and all) The .lib files generated are HUGE (3M, 8M, etc). Shared ones are around 300K-1M. So I\'m quite sur

Things to know:

  • I'm quite sure that I'm using the right static libraries (with dllexport and all)
  • The .lib files generated are HUGE (3M, 8M, etc). Shared ones are around 300K-1M. So I'm quite sure the .lib files are static
  • I want to link to these static library files in a separate solution
  • This is an unmanaged C/C++ project

I've read that I need to use the new UI (Common properties > Add New Reference thingy).开发者_Go百科 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).


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号