"LNK1104: Unable to open file" X ": how do I know who wants to link X?

Okay, I'm stumped. I was messing around with some project settings trying to start linking with library Y instead of library X. When I view the project file ( .vcproj

) and all inherited property sheets ( .vsprops

), there are no references to library X. I closed and reopened Visual Studio to make sure that it doesn't hold on to some old version of the project. However, as suggested in the title, I still get the error

LINK : fatal error LNK1104: cannot open file 'X'

      

When I run into a problem like this with header files (not knowing which file that header contains), I usually rename the problem header to cause an error C1083: Cannot open include file

that tells me which source file is requesting it. But LNK1104

not so useful here. Does anyone have any ideas on how I can track this down? Thank.

+2


source to share


1 answer


There is an option in project settings / linker / general called "show progress", if you set it to "/ VERBOSE" the linker will show you all sorts of things including "/ DEFAULTLIB" items it found. This can be useful depending on whether the import is coming from a lib file or not.

You should also look in the source code for the solution for "#pragma comment (lib, ..." which causes the library to be included in the link-time by default.



If the X library is like msvcrt

, then the dependency most likely comes from an external or third party library that you are using, and the only practical way to avoid this is to add X to "ignore library specific" in your project settings / linker / input.

+4


source







All Articles