Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio links although nothing has changed

I have a couple of VS 2008 projects (C++) that are linked every time I start a build, even though nothing has changed. i.e. I select "Build Solution", it compiles and links, I select "Build Solution" again, it doesn't compile anything, but links again.

This is quite annoying and I have checked everything that might cause it to link again. Is there a way to find out why Visual Studio does or skips certain build steps?

Any input is appreciated!

like image 729
Dietmar Hauser Avatar asked Nov 25 '25 02:11

Dietmar Hauser


1 Answers

I had some time to revisit the problem and a workmate gave me the tip to use "process monitor" from sysinternals to figure out which file is missing.

Lo and behold it worked! It turns out that Visual Studio insists on linking against a bunch of libs even if the app does not need it. Due to an unfortunate (I guess...) chain of events, one of the default library paths disappeared from Visual Studios global settings, so VS couldn't find this lib anymore ("coredll.lib" in my case).

This didn't affect the final output, because this lib is not needed at all, but it still triggered a relink every time.

There are two possible fixes: 1) Restore the path to this lib in the global Visual Studio settings 2) Use "$(NoInherit)" in AdditionalLibraries to get rid of the unneeded lib.

I used solution #1, because #2 needs to be done for each configuration of each project because can't be done via Property Sheets.

like image 88
Dietmar Hauser Avatar answered Nov 28 '25 00:11

Dietmar Hauser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!