tmighty
tmighty

Reputation: 11409

C++ still looks for a .lib file but I can't see why

I have a VS 2010 C++ project. When I try to compile it, it tells me

Error 1 error LNK1104: File "C:\Users\MyUser\Desktop\project1\Debug\mysynth.lib" could not be opened. C:\Users\MyUser\Desktop\project1\subproject\LINK subproject

I have removed all dependencies from Linker->Input->, but it is still looking for the above lib.

Where else could this link be stated?

Upvotes: 0

Views: 87

Answers (2)

Ben Brammer
Ben Brammer

Reputation: 998

Look in the properties explorer. Read the MSBuild documentation for the order that they are read. This is the most confusing part of going from VS2008 forward.

Upvotes: 0

David Heffernan
David Heffernan

Reputation: 613451

You can specify additional linker options in the configuration dialog. Look under the Linker | Command Line page. Perhaps the errant lib is specified there. In any case you can see there the command line that is passed to the linker and determine whether or not your lib file is there.

The easiest way to work out where they are coming from is to open up the project file in a text editor and search for the errant lib file. If the problem is in the project configuration, this tactic is guaranteed to succeed.

If you have removed everything from your project settings, and you are not passing the errant lib to the linker command line, then the other place where a lib file may be specified is in code. In a #pragma statement. It would look like this:

#pragma comment(lib, "mysynth")

Upvotes: 3

Related Questions