ARao
ARao

Reputation: 259

LNK1181: cannot open input file

I've successfully generated a 64-bit library called "myLibrary.lib" in project A using Visual Studio 2010.

Now I've another project B that uses "myLibrary.lib". I include the header files required to use "myLibrary.lib" in project B. Added the .lib into my project and added an entry for it in Linker>Input>Additional Dependencies.

When I try to build, I get an error "LINK : fatal error LNK1181: cannot open input file myLibrary.lib".

Things I've tried:

Is there anything else that I can try to workaround this error?

Upvotes: 1

Views: 8888

Answers (1)

The_Learner
The_Learner

Reputation: 619

Based on the things you have tried, it seems you are going in the right direction. Few months ago, I have faced this problem in my VS 2010. I am getting an error like this

Error   1940    error LNK1181: cannot open input file 'element.lib' 

I could not understand, whats going on, The file that the program is search for element.lib is there in that folder, but I do not understand, why it is showing error, then I tried few more things, as listed below

  1. Either disable incremental linking, by going to

-> Project Properties -> Configuration Properties -> Linker (General) -> Enable Incremental Linking -> "No (/INCREMENTAL:NO)"

  1. cvtres.exe, file error in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cvtres.exe and one at C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\cvtres.exe, Make sure you are using the latest version in both of these locations.

  2. This one is tricky, another possible cause for LNK1181 is that a long file name with embedded spaces was not enclosed in quotation marks. In that case, the linker will only recognize a file name up to the first space, and then assume a file extension of .obj. Make sure the file name length including the file path is less than the characters specified for windows OS, i.e. 128characters including spaces...

Upvotes: 1

Related Questions