TransWikia.com

Link a static library to be compiled with the main application

Stack Overflow Asked by helpme on February 19, 2021

So I have a library I am using as a .lib and I also have the .dll version of it. Whenever I run the exe I have coded in c++ it requires the .dll of the library. Is there any way to avoid this? I remember in the past I was able to have the library be compiled inside of the exe but I cannot recall how I achieved that.

One Answer

what build system are you using? The problem is arising as you are linking to the .dll file, not the .lib file. You will have to tell your linker which version he should use, this is an option in CMake or VS (or whatever you use). See: https://docs.microsoft.com/en-us/cpp/build/walkthrough-creating-and-using-a-static-library-cpp?view=msvc-160.

Edit: Usually, you cannot use a .dll as a .lib or vice-versa. These are two very different things. You will have to find a .lib version of the library you are using, and link against that.

Answered by BarFoo on February 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP