-3

My task is to make myself familiar with a given code which also includes a dll and a lib file. I tried the advice given in this post : How to add additional libraries to Visual Studio project? but apparently the lib file I included cannot be opened. I tried to include it at the linker, as suggested in the other post and then tried the file name as well as the entire path at "additional dependencies" but neither of them worked. Any suggestions?

JanJHF
  • 7
  • 3
  • what exactly did you try? What errors did you encounter? Please show a [mre] – Alan Birtles Jun 30 '21 at 10:30
  • Maybe, try with the MS Visual Studio doc.: [Consuming libraries and components](https://learn.microsoft.com/en-us/cpp/build/adding-references-in-visual-cpp-projects?view=msvc-160) – Scheff's Cat Jun 30 '21 at 12:15

1 Answers1

0

For more details about how to link the .lib, I suggest you could follow the following steps:

1,Add the path to the header file to the Additional Include Directories(property - >c/c++ -> General -> Additional Include Directories)

2,Add the path to the .lib file to the Additional Library Directories (property -> linker -> General -> Additional Library Directories)

3,Add the name of the .lib file with its extension to Additional Dependencies (property -> linker -> input -> Additional Dependencies)

You also need to make sure that you add the configuration properties to the correct build target and platform for your code.

For example: enter image description here

enter image description here

I suggest you could select "All Platforms" for the platform and select "All Configurations" for the Configuration when changing the properties.

enter image description here

Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20
  • @JanJHF Have you got any updates? If your case has been solved, please help to mark answers. If not, just feel free to contact us. Your understanding and cooperation will be grateful. – Jeaninez - MSFT Jul 07 '21 at 08:37