Adding a .lib file to a project in Visual Studio 2

2019-03-10 17:07发布

问题:

This question already has an answer here:

  • How to include libraries in Visual Studio 2012? 2 answers

I have generated a .lib file from another project that I would like to use in my project. I have added the file to LinkerInputAdditional dependencies as bluetoothserialport.lib.

I've added the lib file inside my project at this level: http://i65.tinypic.com/1t9fki.jpg

However I get the following error:

1>LINK : fatal error LNK1104: cannot open file 'bluetoothserialport.lib'

I am using Windows 10 and C++.

回答1:

If you come from an Xcode background you might expect a reasonable IDE to know what all the things in a project are. Visual Studio is not such an IDE.

You need to, explicitly, go to the LinkerGeneralAdditional Library Directories, and add a path to your .lib there.