When trying to import an external library from a different drive I keep getting error LNK1104 "cannot open foo.lib"
I set up the correct paths in:
Properties -> Configuration Properties -> VC++ Directories -> Include Directories
Properties -> Configuration Properties -> VC++ Directories -> Library Directories
Properties -> Configuration Properties -> C/C++ -> General -> Additional Include Directories
Properties -> Configuration Properties -> Linker -> General -> Additional Library Directories
And the correct .lib filename including extension in:
Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
This still gives me the error and the only way I have found to fix it is to manually copy the .lib (or .dll) file inside my project, by copying it the linker can find it and link it correctly.
Pretty much all the questions I have found on SO say to set the correct paths and filename of the .lib like I did, why this is not working and I have to directly copy the .lib file inside my project directory to have it work?
According to the Error LNK1104, as far as I'm concerned the cause of this issue is that the compiler couldn't search the directory of the .lib file.
To fix a path issue, we should verify that the LIB environment variable is set and contains all the directories for the libraries you use, for every configuration you build. In the IDE, the LIB variable is set by the Library Directories property on the VC++ Directories Property Page.
If the static library is not part of the solution,In the VC++ Directories property page, I suggest you should try to add the path to the directory where the .lib file is located in Library Paths.
For more details ,I suggest you could refer to the link.