471,594 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

"Whole program optimization" results in LNK1171 error - cannot find "c2.dll"

Hi,

I have a number of C++ solutions in Visual Studio .NET and when i compile them using "Whole Program Optimization", certain projects report a LNK1171 error saying that c2.dll could not be loaded. The error contains the correct path to c2.dll (and it is definately there).

This only happens on some projects and only when "whole program optimization" option is turned on. If i turn off this option, the problem goes away. I have other projects (in the same solution) and in other solutions, that work with the "whole program optimization" option turned on. Some of the projects that work are larger and some smaller than the projects that don't work, so it is not a size issue.

I have searched the newsgroups and the web and i could not find any solutions to this problem. (Although i did find other people reporting the same problem, eg in microsoft.public.dotnet.languages.vc newsgroup)

Is there any solution to this?

The version i'm using:
Microsoft Development Environment 2002 Version 7.0.9466
Microsoft .NET Framework 1.0 Version 1.0.3705

Thanks,

Nov 16 '05 #1
3 3935
>I have a number of C++ solutions in Visual Studio .NET and when i compile them using "Whole Program Optimization", certain projects report a LNK1171 error saying that c2.dll could not be loaded. The error contains the correct path to c2.dll (and it is definately there).

This only happens on some projects and only when "whole program optimization" option is turned on. If i turn off this option, the problem goes away.


Dmitry,

Do you have a small(ish) project that you can use to demonstrate this
problem?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 16 '05 #2
Hi,

The smallest of the projects is around 1000 files, so i cannot demostrate this problem easily.

Nonetheless, i have found a solution to this - it seems to come from the order of libraries in the
Linker's "AdditionalDependencies" field. Changing the order in which libraries are linked to the
project seems to fix the problem.

Eg if your project links against libraries a.lib, b.lib, c.lib, d.lib etc, then AdditionalDependencies would
contain "a.lib b.lib c.lib d.lib". Moving a.lib to the end of the list (to form "b.lib c.lib d.lib a.lib") would
probably fix the problem. If not, try repeating with the next library ("c.lib d.lib a.lib b.lib") etc. Following
this algorithm has fixed all three of my projects that did not work before.

Regards,
Dmitry
----- David Lowndes wrote: -----
I have a number of C++ solutions in Visual Studio .NET and when i compile them using "Whole Program Optimization", certain projects report a LNK1171 error saying that c2.dll could not be loaded. The error contains the correct path to c2.dll (and it is definately there).
This only happens on some projects and only when "whole program optimization" option is turned on. If i turn off this option, the problem goes away.


Dmitry,

Do you have a small(ish) project that you can use to demonstrate this
problem?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq

Nov 16 '05 #3
>Changing the order in which libraries are linked to the
project seems to fix the problem.


I think that's just as worrying as having the error in the first
place. It'd be good to get a repro for this situation to MS in order
to get it seen to.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by news.iq.ca | last post: by
4 posts views Thread by topmind | last post: by
11 posts views Thread by jobs239 | last post: by
94 posts views Thread by Samuel R. Neff | last post: by
9 posts views Thread by Keith G Hicks | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.